From 602c8137b434c396fa7c2e04c10d831b931f50d1 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 22 Mar 2021 13:25:43 +0000 Subject: [PATCH] Fixes #3462 - Mixed naming regarding mentioned and subscribed in UI --- .../app/controllers/_profile/notification.coffee | 2 +- .../_ui_element/ticket_selector.coffee | 2 +- .../ticket_zoom/sidebar_ticket.coffee | 8 ++++---- .../app/views/profile/notification.jst.eco | 4 ++-- .../app/views/ticket_zoom/sidebar_ticket.jst.eco | 8 ++++---- .../javascripts/app/views/widget/mention.jst.eco | 2 +- app/models/transaction/notification.rb | 2 +- config/application.rb | 8 ++++---- db/migrate/20201110000001_mention_init.rb | 8 ++++---- db/seeds/overviews.rb | 4 ++-- lib/notification_factory/mailer.rb | 8 ++++---- spec/models/ticket_spec.rb | 16 ++++++++-------- spec/system/ticket/zoom_spec.rb | 14 +++++++------- test/browser/agent_ticket_link_test.rb | 2 +- 14 files changed, 44 insertions(+), 44 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_profile/notification.coffee b/app/assets/javascripts/app/controllers/_profile/notification.coffee index 75836bae5..9b9b7b119 100644 --- a/app/assets/javascripts/app/controllers/_profile/notification.coffee +++ b/app/assets/javascripts/app/controllers/_profile/notification.coffee @@ -123,7 +123,7 @@ class ProfileNotification extends App.ControllerSubContent if !params.notification_config[area[0]][area[1]][area[2]] params.notification_config[area[0]][area[1]][area[2]] = {} - for recipientKey in ['owned_by_me', 'owned_by_nobody', 'mentioned', 'no'] + for recipientKey in ['owned_by_me', 'owned_by_nobody', 'subscribed', 'no'] if params.notification_config[area[0]][area[1]][area[2]][recipientKey] == undefined params.notification_config[area[0]][area[1]][area[2]][recipientKey] = false diff --git a/app/assets/javascripts/app/controllers/_ui_element/ticket_selector.coffee b/app/assets/javascripts/app/controllers/_ui_element/ticket_selector.coffee index 591191d0d..f194f826b 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/ticket_selector.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/ticket_selector.coffee @@ -120,7 +120,7 @@ class App.UiElement.ticket_selector elements['ticket.mention_user_ids'] = name: 'mention_user_ids' - display: 'Mention' + display: 'Subscribe' tag: 'autocompletion_ajax' relation: 'User' null: false diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_ticket.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_ticket.coffee index 6d585dce8..b1f5b010b 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_ticket.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_ticket.coffee @@ -131,18 +131,18 @@ class SidebarTicket extends App.Controller if @ticket.currentView() is 'agent' @mentionWidget = new App.WidgetMention( - el: localEl.filter('.mentions') + el: localEl.filter('.js-subscriptions') object: @ticket mentions: @mentions ) @tagWidget = new App.WidgetTag( - el: localEl.filter('.tags') + el: localEl.filter('.js-tags') object_type: 'Ticket' object: @ticket tags: @tags ) @linkWidget = new App.WidgetLink.Ticket( - el: localEl.filter('.links') + el: localEl.filter('.js-links') object_type: 'Ticket' object: @ticket links: @links @@ -150,7 +150,7 @@ class SidebarTicket extends App.Controller if @permissionCheck('knowledge_base.*') and App.Config.get('kb_active') @linkKbAnswerWidget = new App.WidgetLinkKbAnswer( - el: localEl.filter('.link_kb_answers') + el: localEl.filter('.js-linkKbAnswers') object_type: 'Ticket' object: @ticket links: @links diff --git a/app/assets/javascripts/app/views/profile/notification.jst.eco b/app/assets/javascripts/app/views/profile/notification.jst.eco index d6483c06d..b74c8e202 100644 --- a/app/assets/javascripts/app/views/profile/notification.jst.eco +++ b/app/assets/javascripts/app/views/profile/notification.jst.eco @@ -11,7 +11,7 @@ <%- @T('My Tickets') %> <%- @T('Not Assigned') %>* - <%- @T('Mentioned Tickets') %> + <%- @T('Subscribed Tickets') %> <%- @T('All Tickets') %>* <%- @T('Also notify via email') %> @@ -37,7 +37,7 @@ diff --git a/app/assets/javascripts/app/views/ticket_zoom/sidebar_ticket.jst.eco b/app/assets/javascripts/app/views/ticket_zoom/sidebar_ticket.jst.eco index 7349c5014..0fe30b2bd 100644 --- a/app/assets/javascripts/app/views/ticket_zoom/sidebar_ticket.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom/sidebar_ticket.jst.eco @@ -1,8 +1,8 @@
-
- - +
+ +
-
+
diff --git a/app/assets/javascripts/app/views/widget/mention.jst.eco b/app/assets/javascripts/app/views/widget/mention.jst.eco index 5f3818166..4f4d1a952 100644 --- a/app/assets/javascripts/app/views/widget/mention.jst.eco +++ b/app/assets/javascripts/app/views/widget/mention.jst.eco @@ -1,4 +1,4 @@ - +
diff --git a/app/models/transaction/notification.rb b/app/models/transaction/notification.rb index 8faba6ff7..ccfdf8584 100644 --- a/app/models/transaction/notification.rb +++ b/app/models/transaction/notification.rb @@ -62,7 +62,7 @@ class Transaction::Notification next if !mention_user.group_access?(ticket.group_id, 'read') possible_recipients.push mention_user - recipients_reason[mention_user.id] = 'are mentioned' + recipients_reason[mention_user.id] = 'are subscribed' end end diff --git a/config/application.rb b/config/application.rb index f0a57a17d..12f9ecc49 100644 --- a/config/application.rb +++ b/config/application.rb @@ -49,7 +49,7 @@ module Zammad criteria: { owned_by_me: true, owned_by_nobody: true, - mentioned: true, + subscribed: true, no: false, }, channel: { @@ -61,7 +61,7 @@ module Zammad criteria: { owned_by_me: true, owned_by_nobody: true, - mentioned: true, + subscribed: true, no: false, }, channel: { @@ -73,7 +73,7 @@ module Zammad criteria: { owned_by_me: true, owned_by_nobody: false, - mentioned: false, + subscribed: false, no: false, }, channel: { @@ -85,7 +85,7 @@ module Zammad criteria: { owned_by_me: true, owned_by_nobody: false, - mentioned: false, + subscribed: false, no: false, }, channel: { diff --git a/db/migrate/20201110000001_mention_init.rb b/db/migrate/20201110000001_mention_init.rb index 95e2552dc..f42bf7f0e 100644 --- a/db/migrate/20201110000001_mention_init.rb +++ b/db/migrate/20201110000001_mention_init.rb @@ -23,8 +23,8 @@ class MentionInit < ActiveRecord::Migration[5.2] def create_overview Overview.create_if_not_exists( - name: 'My mentioned Tickets', - link: 'my_mentioned_tickets', + name: 'My subscribed Tickets', + link: 'my_subscribed_tickets', prio: 1025, role_ids: Role.with_permissions('ticket.agent').pluck(:id), condition: { 'ticket.mention_user_ids'=>{ 'operator' => 'is', 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '' } }, @@ -55,11 +55,11 @@ class MentionInit < ActiveRecord::Migration[5.2] def update_user_matrix_by_user(user) %w[create update].each do |type| - user.preferences['notification_config']['matrix'][type]['criteria']['mentioned'] = true + user.preferences['notification_config']['matrix'][type]['criteria']['subscribed'] = true end %w[reminder_reached escalation].each do |type| - user.preferences['notification_config']['matrix'][type]['criteria']['mentioned'] = false + user.preferences['notification_config']['matrix'][type]['criteria']['subscribed'] = false end user.save! end diff --git a/db/seeds/overviews.rb b/db/seeds/overviews.rb index 9d551c035..77278338c 100644 --- a/db/seeds/overviews.rb +++ b/db/seeds/overviews.rb @@ -86,8 +86,8 @@ Overview.create_if_not_exists( ) Overview.create_if_not_exists( - name: 'My mentioned Tickets', - link: 'my_mentioned_tickets', + name: 'My subscribed Tickets', + link: 'my_subscribed_tickets', prio: 1025, role_ids: [overview_role.id], condition: { 'ticket.mention_user_ids'=>{ 'operator' => 'is', 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '' } }, diff --git a/lib/notification_factory/mailer.rb b/lib/notification_factory/mailer.rb index c72c9f7fa..ef842ef67 100644 --- a/lib/notification_factory/mailer.rb +++ b/lib/notification_factory/mailer.rb @@ -48,7 +48,7 @@ returns owned_by_nobody = false owned_by_me = false - mentioned = false + subscribed = false case ticket.owner_id when 1 owned_by_nobody = true @@ -70,9 +70,9 @@ returns end end - # always trigger notifications for user if he is mentioned + # always trigger notifications for user if he is subscribed if owned_by_me == false && ticket.mentions.exists?(user: user) - mentioned = true + subscribed = true end # check if group is in selected groups @@ -115,7 +115,7 @@ returns channels: channels } end - if data['criteria']['mentioned'] && mentioned + if data['criteria']['subscribed'] && subscribed return { user: user, channels: channels diff --git a/spec/models/ticket_spec.rb b/spec/models/ticket_spec.rb index 8ae5c9731..9b58f6c2d 100644 --- a/spec/models/ticket_spec.rb +++ b/spec/models/ticket_spec.rb @@ -1528,19 +1528,19 @@ RSpec.describe Ticket, type: :model do let(:prefs_matrix_no_mentions) do { 'notification_config' => { 'matrix' => - { 'create' => { 'criteria' => { 'owned_by_me' => true, 'owned_by_nobody' => true, 'mentioned' => false, 'no' => true }, 'channel' => { 'email' => true, 'online' => true } }, - 'update' => { 'criteria' => { 'owned_by_me' => true, 'owned_by_nobody' => true, 'mentioned' => false, 'no' => true }, 'channel' => { 'email' => true, 'online' => true } }, - 'reminder_reached' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'mentioned' => false, 'no' => false }, 'channel' => { 'email' => false, 'online' => false } }, - 'escalation' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'mentioned' => false, 'no' => false }, 'channel' => { 'email' => false, 'online' => false } } } } } + { 'create' => { 'criteria' => { 'owned_by_me' => true, 'owned_by_nobody' => true, 'subscribed' => false, 'no' => true }, 'channel' => { 'email' => true, 'online' => true } }, + 'update' => { 'criteria' => { 'owned_by_me' => true, 'owned_by_nobody' => true, 'subscribed' => false, 'no' => true }, 'channel' => { 'email' => true, 'online' => true } }, + 'reminder_reached' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'subscribed' => false, 'no' => false }, 'channel' => { 'email' => false, 'online' => false } }, + 'escalation' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'subscribed' => false, 'no' => false }, 'channel' => { 'email' => false, 'online' => false } } } } } end let(:prefs_matrix_only_mentions) do { 'notification_config' => { 'matrix' => - { 'create' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'mentioned' => true, 'no' => false }, 'channel' => { 'email' => true, 'online' => true } }, - 'update' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'mentioned' => true, 'no' => false }, 'channel' => { 'email' => true, 'online' => true } }, - 'reminder_reached' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'mentioned' => true, 'no' => false }, 'channel' => { 'email' => false, 'online' => false } }, - 'escalation' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'mentioned' => true, 'no' => false }, 'channel' => { 'email' => false, 'online' => false } } } } } + { 'create' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'subscribed' => true, 'no' => false }, 'channel' => { 'email' => true, 'online' => true } }, + 'update' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'subscribed' => true, 'no' => false }, 'channel' => { 'email' => true, 'online' => true } }, + 'reminder_reached' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'subscribed' => true, 'no' => false }, 'channel' => { 'email' => false, 'online' => false } }, + 'escalation' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'subscribed' => true, 'no' => false }, 'channel' => { 'email' => false, 'online' => false } } } } } end let(:mention_group) { create(:group) } diff --git a/spec/system/ticket/zoom_spec.rb b/spec/system/ticket/zoom_spec.rb index 634e37553..1739edb71 100644 --- a/spec/system/ticket/zoom_spec.rb +++ b/spec/system/ticket/zoom_spec.rb @@ -1286,16 +1286,16 @@ RSpec.describe 'Ticket zoom', type: :system do ensure_websocket do visit "ticket/zoom/#{ticket.id}" - click '.mentions .js-subscribe input' - expect(page).to have_selector('.mentions .js-unsubscribe input', wait: 10) - expect(page).to have_selector('.mentions span.avatar', wait: 10) + click '.js-subscriptions .js-subscribe input' + expect(page).to have_selector('.js-subscriptions .js-unsubscribe input', wait: 10) + expect(page).to have_selector('.js-subscriptions span.avatar', wait: 10) - click '.mentions .js-unsubscribe input' - expect(page).to have_selector('.mentions .js-subscribe input', wait: 10) - expect(page).to have_no_selector('.mentions span.avatar', wait: 10) + click '.js-subscriptions .js-unsubscribe input' + expect(page).to have_selector('.js-subscriptions .js-subscribe input', wait: 10) + expect(page).to have_no_selector('.js-subscriptions span.avatar', wait: 10) create(:mention, mentionable: ticket, user: other_agent) - expect(page).to have_selector('.mentions span.avatar', wait: 10) + expect(page).to have_selector('.js-subscriptions span.avatar', wait: 10) # check history for mention entries click 'h2.sidebar-header-headline.js-headline' diff --git a/test/browser/agent_ticket_link_test.rb b/test/browser/agent_ticket_link_test.rb index 97d677851..fde4d85de 100644 --- a/test/browser/agent_ticket_link_test.rb +++ b/test/browser/agent_ticket_link_test.rb @@ -43,7 +43,7 @@ class AgentTicketLinkTest < TestCase ) click( - css: '.content.active .links .js-add', + css: '.content.active .js-links .js-add', ) modal_ready()