Repository navigation
feat: show state and responsible subject changes in issue activity #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xhyrom
wants to merge
78
commits into
main
Choose a base branch
from
feat/new-activity-types
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 52 commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
4b630cd
fix(notifications): use cms page url instead of url for method for links
xhyrom f736c89
feat: new activity types
xhyrom 8334467
Merge branch 'main' into feat/new-activity-types
xhyrom 3ce6e45
feat: mig
xhyrom 7f7b4b1
refactor: cleanup
xhyrom fa11e90
Fix syncing previous responsible subject
luciajanikova 2cf0659
Update SyncIssueActivityObjectToTriageJob
luciajanikova c3702de
Fix SyncIssueActivityObjectToTriageJob
luciajanikova 9fc5ebc
Fix SyncIssueActivityObjectToTriageJob
luciajanikova 84aa166
Fix SQL injection vulnerability in PgSearch::Faster fulltext_search
jsuchal 7ff0c6f
fix(comments): sanitize and normalize html
xhyrom 0877e3b
style: lint
xhyrom 46a9ace
feat: add db migration for converting agent, responsible html comment…
xhyrom a1ceb2b
refactor: simplify
xhyrom fea4dd5
refactor: simplify
xhyrom 86de8e0
refactor: simplify
xhyrom ff4be47
refactor: simplify
xhyrom 546471b
refactor: remove unrelated changes
xhyrom 2aee176
Fix CMS pages import
luciajanikova 05a4243
Retry all jobs
crutch 3baeede
Fix rubocop
crutch 086bded
update osm client to new osm responses
celuchmarek 3bb58b4
rm unused method
celuchmarek 682a25d
Do not initialize omniauth_providers in development
crutch 5de8324
Use postgres from docker
crutch 6413574
Fill NOTIFICATION_SMTP_USERNAME in env sample
crutch 43f5245
Use full connection string incl. database
crutch c0cd19e
Remove empty LEGACY_DB_URL from .env.sample
celuchmarek 4101a65
Remove empty LEGACY_DB_URL from .env.test
celuchmarek 83b6a4b
Add Múdre mestá to header
luciajanikova 795fe2b
add postgis handling
celuchmarek 11cba4b
rm old find_by_address methods
celuchmarek dd9c852
update
celuchmarek f961c06
use tmp path for the json
celuchmarek 721ce5e
rm unique index on boundaries
celuchmarek 7517d59
lint
celuchmarek 55def4d
Sync previous RS only for issues in resolution process
luciajanikova 485389c
Set backoffice owner & group for new backoffice tickets
luciajanikova 8593d8d
use paging in zammad triage group listing
celuchmarek 797e08e
Issue Updates without author
luciajanikova a1ec877
send categories in issue update
celuchmarek f2ecd50
parametrize user limits via ENV
celuchmarek c663b4d
incluse response status in fire webhook error message
celuchmarek f6232d6
allow all 2xx status codes for webhooks
celuchmarek ace01f5
raise response body if webhook failed
celuchmarek c308d79
Merge branch 'main' into feat/new-activity-types
xhyrom f661a70
feat: state change
xhyrom 62a5619
feat: sent t oresponsible, in progress, waiting and rs change notific…
xhyrom a9b26b4
refactor: cleanup
xhyrom d4bd9ec
refactor: cleanup
xhyrom 00b43e9
refactor: cleanup
xhyrom 239e6ae
fix: add schema info
xhyrom ad27f1f
feat: use 'na' instead of right arrow
xhyrom ca1c393
Merge branch 'main' into feat/new-activity-types
xhyrom 44f3430
fix: remove issue waiting from notification mailer
xhyrom a9cf2f8
Merge branch 'main' into feat/new-activity-types
xhyrom 0c7dee2
feat: replace samospráva with zodpovedný subjekt
xhyrom d9c23d7
feat: shorter texts
xhyrom 3864bef
feat: use arrow right, state unknown badge
xhyrom 5cc185f
Merge remote-tracking branch 'origin/main' into feat/new-activity-types
xhyrom 23a0f6f
test: notification stater
xhyrom 93019a1
feat: history mig
xhyrom b84d063
feat: db mig
xhyrom 45ea742
fix: mig and aktivita
xhyrom 7f24c3f
refactor: cleanup
xhyrom e981942
refactor: cleanup
xhyrom ede802b
merge
xhyrom b37a000
style: lint
xhyrom d9600e8
feat: backfill issue state changes job
xhyrom c67a76a
feat: backfill issue history
xhyrom 6b34ce8
Merge branch 'main' into feat/new-activity-types
xhyrom b4c6396
test: zammad tests
xhyrom f9f46c6
Merge branch 'main' into feat/new-activity-types
mirrec c8d9d6b
Update annotations
mirrec 7eff555
test: rename backfill issue history test so it runs
mirrec 359fd26
docs: describe state and RS history, new emails and backfill job
mirrec db18df2
fix: notify about the first responsible subject of an issue
mirrec ad20c18
Merge branch 'main' into feat/new-activity-types
mirrec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/jobs/notifications/publish_issue_responsible_subject_changed_job.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| module Notifications | ||
| class PublishIssueResponsibleSubjectChangedJob < ApplicationJob | ||
| def perform(issue, responsible_subject_id_change: [], notification_mailer: NotificationMailer) | ||
| return unless responsible_subject_id_change.present? | ||
|
|
||
| previous_rs = ResponsibleSubject.find(responsible_subject_id_change.first) | ||
|
|
||
| issue.subscriptions.active.each do |subscription| | ||
| next unless subscription.subscriber.email_notifiable? | ||
|
|
||
| notification_mailer.with(subscription: subscription).issue_responsible_subject_changed(previous_rs).deliver_later | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # == Schema Information | ||
| # | ||
| # Table name: issues_state_changes | ||
| # | ||
| # id :bigint not null, primary key | ||
| # hidden :boolean default(FALSE), not null | ||
| # uuid :uuid not null | ||
| # created_at :datetime not null | ||
| # updated_at :datetime not null | ||
| # activity_id :bigint not null | ||
| # new_state_id :bigint not null | ||
| # previous_state_id :bigint | ||
| # triage_external_id :integer | ||
| # | ||
| class Issues::StateChange < ApplicationRecord | ||
| belongs_to :activity, class_name: "Issues::Activity", dependent: :destroy | ||
| belongs_to :previous_state, optional: true, class_name: "Issues::State" | ||
| belongs_to :new_state, class_name: "Issues::State" | ||
| delegate :issue, to: :activity | ||
|
|
||
| before_create -> { self.uuid = SecureRandom.uuid } | ||
|
|
||
| def author_display_name | ||
| "Odkaz pre starostu" | ||
| end | ||
|
|
||
| def triage_visible? | ||
| false | ||
| end | ||
|
|
||
| def visible? | ||
| !hidden | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # == Schema Information | ||
| # | ||
| # Table name: issues_activities | ||
| # | ||
| # id :bigint not null, primary key | ||
| # dislikes_count :integer default(0), not null | ||
| # likes_count :integer default(0), not null | ||
| # type :string not null | ||
| # created_at :datetime not null | ||
| # updated_at :datetime not null | ||
| # issue_id :bigint not null | ||
| # | ||
| class Issues::StateChangeActivity < Issues::Activity | ||
| has_one :activity_object, class_name: "Issues::StateChange", foreign_key: :activity_id, dependent: :destroy | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # == Schema Information | ||
| # | ||
| # Table name: issues_system_responsible_subject_changes | ||
| # | ||
| # id :bigint not null, primary key | ||
| # hidden :boolean default(FALSE), not null | ||
| # uuid :uuid not null | ||
| # created_at :datetime not null | ||
| # updated_at :datetime not null | ||
| # activity_id :bigint not null | ||
| # new_responsible_subject_id :bigint | ||
| # previous_responsible_subject_id :bigint | ||
| # | ||
| class Issues::SystemResponsibleSubjectChange < ApplicationRecord | ||
| belongs_to :activity, class_name: "Issues::Activity", dependent: :destroy | ||
| belongs_to :previous_responsible_subject, optional: true, class_name: "::ResponsibleSubject" | ||
| belongs_to :new_responsible_subject, optional: true, class_name: "::ResponsibleSubject" | ||
|
|
||
| delegate :issue, to: :activity | ||
|
|
||
| before_create -> { self.uuid = SecureRandom.uuid } | ||
|
|
||
| def triage_visible? | ||
| false | ||
| end | ||
|
|
||
| def visible? | ||
| !hidden | ||
| end | ||
| end | ||
15 changes: 15 additions & 0 deletions
15
app/models/issues/system_responsible_subject_change_activity.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # == Schema Information | ||
| # | ||
| # Table name: issues_activities | ||
| # | ||
| # id :bigint not null, primary key | ||
| # dislikes_count :integer default(0), not null | ||
| # likes_count :integer default(0), not null | ||
| # type :string not null | ||
| # created_at :datetime not null | ||
| # updated_at :datetime not null | ||
| # issue_id :bigint not null | ||
| # | ||
| class Issues::SystemResponsibleSubjectChangeActivity < Issues::Activity | ||
|
xhyrom marked this conversation as resolved.
|
||
| has_one :activity_object, class_name: "Issues::SystemResponsibleSubjectChange", foreign_key: :activity_id, dependent: :destroy | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <% change = state_change %> | ||
| <%= turbo_frame_tag change do %> | ||
| <div class="state-change-message" id="state_change_<%= change.id %>"> | ||
|
|
||
| <div class="change-icon"> | ||
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | ||
| <path d="M8 3 4 7l4 4"/> | ||
| <path d="M4 7h16"/> | ||
| <path d="M16 21l4-4-4-4"/> | ||
| <path d="M20 17H4"/> | ||
| </svg> | ||
| </div> | ||
|
|
||
| <div class="content"> | ||
| <div class="text"> | ||
| <span>Stav podnetu bol zmenený z</span> | ||
|
|
||
| <% if change.previous_state %> | ||
| <span class="state-badge state-<%= change.previous_state.name.parameterize %>"> | ||
| <%= change.previous_state.name %> | ||
| </span> | ||
| <% else %> | ||
| <span class="state-badge state-unknown">neznámeho stavu</span> | ||
| <% end %> | ||
|
|
||
| <svg class="arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | ||
| <path d="M5 12h14"></path> | ||
| <path d="m12 5 7 7-7 7"></path> | ||
| </svg> | ||
|
xhyrom marked this conversation as resolved.
|
||
|
|
||
| <span class="state-badge state-<%= change.new_state.name.parameterize %>"> | ||
| <%= change.new_state.name %> | ||
| </span> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="date"><%= l change.created_at.to_date %></div> | ||
| </div> | ||
| <% end %> | ||
50 changes: 50 additions & 0 deletions
50
...ews/issues/system_responsible_subject_changes/_system_responsible_subject_change.html.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| <% change = system_responsible_subject_change %> | ||
| <%= turbo_frame_tag change do %> | ||
| <div class="state-change-message" id="system_rs_change_<%= change.id %>"> | ||
|
|
||
| <div class="change-icon"> | ||
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | ||
| <rect x="4" y="2" width="16" height="20" rx="2" ry="2"></rect> | ||
| <path d="M9 22v-4h6v4"></path> | ||
| <path d="M8 6h.01"></path> | ||
| <path d="M16 6h.01"></path> | ||
| <path d="M12 6h.01"></path> | ||
| <path d="M12 10h.01"></path> | ||
| <path d="M12 14h.01"></path> | ||
| <path d="M16 10h.01"></path> | ||
| <path d="M16 14h.01"></path> | ||
| <path d="M8 10h.01"></path> | ||
| <path d="M8 14h.01"></path> | ||
| </svg> | ||
| </div> | ||
|
|
||
| <div class="content"> | ||
| <div class="text"> | ||
| <span>Zodpovedný subjekt bol zmenený z</span> | ||
|
xhyrom marked this conversation as resolved.
Outdated
|
||
|
|
||
| <% if change.previous_responsible_subject %> | ||
| <span class="state-badge state-unknown" style="background-color: #f1f5f9; color: #475569;"> | ||
|
xhyrom marked this conversation as resolved.
Outdated
|
||
| <%= change.previous_responsible_subject.subject_name %> | ||
| </span> | ||
| <% else %> | ||
| <span class="state-badge state-unknown">neznámeho subjektu</span> | ||
| <% end %> | ||
|
|
||
| <svg class="arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | ||
| <path d="M5 12h14"></path> | ||
| <path d="m12 5 7 7-7 7"></path> | ||
| </svg> | ||
|
xhyrom marked this conversation as resolved.
|
||
|
|
||
| <% if change.new_responsible_subject %> | ||
| <span class="state-badge state-unknown" style="background-color: #e2e8f0; color: #1e293b; font-weight: 600;"> | ||
| <%= change.new_responsible_subject.subject_name %> | ||
| </span> | ||
| <% else %> | ||
| <span class="state-badge state-unknown">nikoho</span> | ||
| <% end %> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="date"><%= l change.created_at.to_date %></div> | ||
| </div> | ||
| <% end %> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <%= ops_title "Podnet je v riešení" %> | ||
| <p class="ops-email-paragraph"> | ||
| <% if @issue.author == @user %> | ||
| Dobrý deň, samospráva začala aktívne pracovať na Vašom podnete <%= ops_issue_link @issue %>. | ||
|
xhyrom marked this conversation as resolved.
Outdated
|
||
| <% else %> | ||
| Dobrý deň, samospráva začala aktívne pracovať na podnete <%= ops_issue_link @issue %>, ktorý sledujete. | ||
| <% end %> | ||
| Detailné informácie o postupe prác nájdete v <b><%= link_to "detaile podnetu", issue_url(@issue), class: "ops-email-link", target: "_blank" %></b>. | ||
| </p> | ||
| <p class="ops-email-paragraph"> | ||
| <%= ops_button "Reagovať na nový status", "#{issue_url(@issue)}#new_issue_activity" %> | ||
| </p> | ||
| <%= render "signature" %> | ||
| <%= render "unsubscribe" %> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.