Fixes #3462 - Mixed naming regarding mentioned and subscribed in UI

This commit is contained in:
Martin Edenhofer 2021-03-22 13:25:43 +00:00 committed by Thorsten Eckel
parent cfa02c9038
commit 602c8137b4
14 changed files with 44 additions and 44 deletions

View file

@ -123,7 +123,7 @@ class ProfileNotification extends App.ControllerSubContent
if !params.notification_config[area[0]][area[1]][area[2]] if !params.notification_config[area[0]][area[1]][area[2]]
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 if params.notification_config[area[0]][area[1]][area[2]][recipientKey] == undefined
params.notification_config[area[0]][area[1]][area[2]][recipientKey] = false params.notification_config[area[0]][area[1]][area[2]][recipientKey] = false

View file

@ -120,7 +120,7 @@ class App.UiElement.ticket_selector
elements['ticket.mention_user_ids'] = elements['ticket.mention_user_ids'] =
name: 'mention_user_ids' name: 'mention_user_ids'
display: 'Mention' display: 'Subscribe'
tag: 'autocompletion_ajax' tag: 'autocompletion_ajax'
relation: 'User' relation: 'User'
null: false null: false

View file

@ -131,18 +131,18 @@ class SidebarTicket extends App.Controller
if @ticket.currentView() is 'agent' if @ticket.currentView() is 'agent'
@mentionWidget = new App.WidgetMention( @mentionWidget = new App.WidgetMention(
el: localEl.filter('.mentions') el: localEl.filter('.js-subscriptions')
object: @ticket object: @ticket
mentions: @mentions mentions: @mentions
) )
@tagWidget = new App.WidgetTag( @tagWidget = new App.WidgetTag(
el: localEl.filter('.tags') el: localEl.filter('.js-tags')
object_type: 'Ticket' object_type: 'Ticket'
object: @ticket object: @ticket
tags: @tags tags: @tags
) )
@linkWidget = new App.WidgetLink.Ticket( @linkWidget = new App.WidgetLink.Ticket(
el: localEl.filter('.links') el: localEl.filter('.js-links')
object_type: 'Ticket' object_type: 'Ticket'
object: @ticket object: @ticket
links: @links links: @links
@ -150,7 +150,7 @@ class SidebarTicket extends App.Controller
if @permissionCheck('knowledge_base.*') and App.Config.get('kb_active') if @permissionCheck('knowledge_base.*') and App.Config.get('kb_active')
@linkKbAnswerWidget = new App.WidgetLinkKbAnswer( @linkKbAnswerWidget = new App.WidgetLinkKbAnswer(
el: localEl.filter('.link_kb_answers') el: localEl.filter('.js-linkKbAnswers')
object_type: 'Ticket' object_type: 'Ticket'
object: @ticket object: @ticket
links: @links links: @links

View file

@ -11,7 +11,7 @@
<th> <th>
<th width="16%" style="text-align: center;"><%- @T('My Tickets') %> <th width="16%" style="text-align: center;"><%- @T('My Tickets') %>
<th width="16%" style="text-align: center;"><%- @T('Not Assigned') %>* <th width="16%" style="text-align: center;"><%- @T('Not Assigned') %>*
<th width="16%" style="text-align: center;"><%- @T('Mentioned Tickets') %> <th width="16%" style="text-align: center;"><%- @T('Subscribed Tickets') %>
<th width="16%" style="text-align: center;"><%- @T('All Tickets') %>* <th width="16%" style="text-align: center;"><%- @T('All Tickets') %>*
<th width="120px" class="settings-list-separator" style="text-align: center;"><%- @T('Also notify via email') %> <th width="120px" class="settings-list-separator" style="text-align: center;"><%- @T('Also notify via email') %>
</thead> </thead>
@ -37,7 +37,7 @@
</label> </label>
<td class="u-positionOrigin"> <td class="u-positionOrigin">
<label class="checkbox-replacement checkbox-replacement--fullscreen"> <label class="checkbox-replacement checkbox-replacement--fullscreen">
<input type="checkbox" name="matrix.<%= key %>.criteria.mentioned" value="true"<% if criteria && criteria.mentioned: %> checked<% end %> /> <input type="checkbox" name="matrix.<%= key %>.criteria.subscribed" value="true"<% if criteria && criteria.subscribed: %> checked<% end %> />
<%- @Icon('checkbox', 'icon-unchecked') %> <%- @Icon('checkbox', 'icon-unchecked') %>
<%- @Icon('checkbox-checked', 'icon-checked') %> <%- @Icon('checkbox-checked', 'icon-checked') %>
</label> </label>

View file

@ -1,8 +1,8 @@
<form> <form>
<fieldset class="edit"></fieldset> <fieldset class="edit"></fieldset>
</form> </form>
<div class="tags"></div> <div class="js-tags tags"></div>
<div class="links"></div> <div class="js-links links"></div>
<div class="link_kb_answers"></div> <div class="js-linkKbAnswers link_kb_answers"></div>
<div class="js-timeUnit"></div> <div class="js-timeUnit"></div>
<div class="mentions"></div> <div class="js-subscriptions"></div>

View file

@ -1,4 +1,4 @@
<label><%- @T('Mentions') %></label> <label><%- @T('Notifications') %></label>
<form class="ui-front mentionWidget"> <form class="ui-front mentionWidget">
<div class="js-subscribe<% if @subscribed: %> hidden<% end %>"> <div class="js-subscribe<% if @subscribed: %> hidden<% end %>">
<input type="button" class="btn btn--fullWidth" name="subscribe" value="<%- @T('Subscribe') %>"> <input type="button" class="btn btn--fullWidth" name="subscribe" value="<%- @T('Subscribe') %>">

View file

@ -62,7 +62,7 @@ class Transaction::Notification
next if !mention_user.group_access?(ticket.group_id, 'read') next if !mention_user.group_access?(ticket.group_id, 'read')
possible_recipients.push mention_user possible_recipients.push mention_user
recipients_reason[mention_user.id] = 'are mentioned' recipients_reason[mention_user.id] = 'are subscribed'
end end
end end

View file

@ -49,7 +49,7 @@ module Zammad
criteria: { criteria: {
owned_by_me: true, owned_by_me: true,
owned_by_nobody: true, owned_by_nobody: true,
mentioned: true, subscribed: true,
no: false, no: false,
}, },
channel: { channel: {
@ -61,7 +61,7 @@ module Zammad
criteria: { criteria: {
owned_by_me: true, owned_by_me: true,
owned_by_nobody: true, owned_by_nobody: true,
mentioned: true, subscribed: true,
no: false, no: false,
}, },
channel: { channel: {
@ -73,7 +73,7 @@ module Zammad
criteria: { criteria: {
owned_by_me: true, owned_by_me: true,
owned_by_nobody: false, owned_by_nobody: false,
mentioned: false, subscribed: false,
no: false, no: false,
}, },
channel: { channel: {
@ -85,7 +85,7 @@ module Zammad
criteria: { criteria: {
owned_by_me: true, owned_by_me: true,
owned_by_nobody: false, owned_by_nobody: false,
mentioned: false, subscribed: false,
no: false, no: false,
}, },
channel: { channel: {

View file

@ -23,8 +23,8 @@ class MentionInit < ActiveRecord::Migration[5.2]
def create_overview def create_overview
Overview.create_if_not_exists( Overview.create_if_not_exists(
name: 'My mentioned Tickets', name: 'My subscribed Tickets',
link: 'my_mentioned_tickets', link: 'my_subscribed_tickets',
prio: 1025, prio: 1025,
role_ids: Role.with_permissions('ticket.agent').pluck(:id), role_ids: Role.with_permissions('ticket.agent').pluck(:id),
condition: { 'ticket.mention_user_ids'=>{ 'operator' => 'is', 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '' } }, 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) def update_user_matrix_by_user(user)
%w[create update].each do |type| %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 end
%w[reminder_reached escalation].each do |type| %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 end
user.save! user.save!
end end

View file

@ -86,8 +86,8 @@ Overview.create_if_not_exists(
) )
Overview.create_if_not_exists( Overview.create_if_not_exists(
name: 'My mentioned Tickets', name: 'My subscribed Tickets',
link: 'my_mentioned_tickets', link: 'my_subscribed_tickets',
prio: 1025, prio: 1025,
role_ids: [overview_role.id], role_ids: [overview_role.id],
condition: { 'ticket.mention_user_ids'=>{ 'operator' => 'is', 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '' } }, condition: { 'ticket.mention_user_ids'=>{ 'operator' => 'is', 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '' } },

View file

@ -48,7 +48,7 @@ returns
owned_by_nobody = false owned_by_nobody = false
owned_by_me = false owned_by_me = false
mentioned = false subscribed = false
case ticket.owner_id case ticket.owner_id
when 1 when 1
owned_by_nobody = true owned_by_nobody = true
@ -70,9 +70,9 @@ returns
end end
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) if owned_by_me == false && ticket.mentions.exists?(user: user)
mentioned = true subscribed = true
end end
# check if group is in selected groups # check if group is in selected groups
@ -115,7 +115,7 @@ returns
channels: channels channels: channels
} }
end end
if data['criteria']['mentioned'] && mentioned if data['criteria']['subscribed'] && subscribed
return { return {
user: user, user: user,
channels: channels channels: channels

View file

@ -1528,19 +1528,19 @@ RSpec.describe Ticket, type: :model do
let(:prefs_matrix_no_mentions) do let(:prefs_matrix_no_mentions) do
{ 'notification_config' => { 'notification_config' =>
{ 'matrix' => { 'matrix' =>
{ 'create' => { 'criteria' => { 'owned_by_me' => true, 'owned_by_nobody' => true, 'mentioned' => false, 'no' => true }, 'channel' => { 'email' => true, 'online' => true } }, { '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, 'mentioned' => 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, 'mentioned' => false, 'no' => false }, 'channel' => { 'email' => false, 'online' => false } }, '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, 'mentioned' => 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 end
let(:prefs_matrix_only_mentions) do let(:prefs_matrix_only_mentions) do
{ 'notification_config' => { 'notification_config' =>
{ 'matrix' => { 'matrix' =>
{ 'create' => { 'criteria' => { 'owned_by_me' => false, 'owned_by_nobody' => false, 'mentioned' => true, 'no' => false }, 'channel' => { 'email' => true, 'online' => true } }, { '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, 'mentioned' => 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, 'mentioned' => true, 'no' => false }, 'channel' => { 'email' => false, 'online' => false } }, '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, 'mentioned' => 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 end
let(:mention_group) { create(:group) } let(:mention_group) { create(:group) }

View file

@ -1286,16 +1286,16 @@ RSpec.describe 'Ticket zoom', type: :system do
ensure_websocket do ensure_websocket do
visit "ticket/zoom/#{ticket.id}" visit "ticket/zoom/#{ticket.id}"
click '.mentions .js-subscribe input' click '.js-subscriptions .js-subscribe input'
expect(page).to have_selector('.mentions .js-unsubscribe input', wait: 10) expect(page).to have_selector('.js-subscriptions .js-unsubscribe input', wait: 10)
expect(page).to have_selector('.mentions span.avatar', wait: 10) expect(page).to have_selector('.js-subscriptions span.avatar', wait: 10)
click '.mentions .js-unsubscribe input' click '.js-subscriptions .js-unsubscribe input'
expect(page).to have_selector('.mentions .js-subscribe input', wait: 10) expect(page).to have_selector('.js-subscriptions .js-subscribe input', wait: 10)
expect(page).to have_no_selector('.mentions span.avatar', wait: 10) expect(page).to have_no_selector('.js-subscriptions span.avatar', wait: 10)
create(:mention, mentionable: ticket, user: other_agent) 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 # check history for mention entries
click 'h2.sidebar-header-headline.js-headline' click 'h2.sidebar-header-headline.js-headline'

View file

@ -43,7 +43,7 @@ class AgentTicketLinkTest < TestCase
) )
click( click(
css: '.content.active .links .js-add', css: '.content.active .js-links .js-add',
) )
modal_ready() modal_ready()