Fixes #3984 - Mention history does not show properly who got added.
This commit is contained in:
parent
1049368fc7
commit
740f8bf4d2
3 changed files with 14 additions and 3 deletions
|
@ -100,7 +100,7 @@ class App.GenericHistory extends App.ControllerModal
|
||||||
content += " '#{ @translateItemValue(item, item.value_from) }'"
|
content += " '#{ @translateItemValue(item, item.value_from) }'"
|
||||||
|
|
||||||
if item.value_to
|
if item.value_to
|
||||||
if item.value_from
|
if item.value_from || item.object is 'Mention'
|
||||||
content += ' →'
|
content += ' →'
|
||||||
content += " '#{ @translateItemValue(item, item.value_to) }'"
|
content += " '#{ @translateItemValue(item, item.value_to) }'"
|
||||||
else if item.value_from
|
else if item.value_from
|
||||||
|
@ -114,6 +114,14 @@ class App.GenericHistory extends App.ControllerModal
|
||||||
newItems
|
newItems
|
||||||
|
|
||||||
translateItemValue: ({object, attribute}, value) ->
|
translateItemValue: ({object, attribute}, value) ->
|
||||||
|
if object is 'Mention'
|
||||||
|
result = '-'
|
||||||
|
if value
|
||||||
|
user = App.User.find(value)
|
||||||
|
if user
|
||||||
|
result = user.displayName()
|
||||||
|
return result
|
||||||
|
|
||||||
localAttribute = @objectAttribute(object, attribute)
|
localAttribute = @objectAttribute(object, attribute)
|
||||||
if localAttribute && localAttribute.tag is 'datetime'
|
if localAttribute && localAttribute.tag is 'datetime'
|
||||||
return App.i18n.translateTimestamp(value)
|
return App.i18n.translateTimestamp(value)
|
||||||
|
|
|
@ -30,6 +30,7 @@ class Mention < ApplicationModel
|
||||||
{
|
{
|
||||||
related_o_id: mentionable_id,
|
related_o_id: mentionable_id,
|
||||||
related_history_object: mentionable_type,
|
related_history_object: mentionable_type,
|
||||||
|
value_to: user.id,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1381,6 +1381,7 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
context 'when logged in as agent' do
|
context 'when logged in as agent' do
|
||||||
let(:ticket) { create(:ticket, group: Group.find_by(name: 'Users')) }
|
let(:ticket) { create(:ticket, group: Group.find_by(name: 'Users')) }
|
||||||
let!(:other_agent) { create(:agent, groups: [Group.find_by(name: 'Users')]) }
|
let!(:other_agent) { create(:agent, groups: [Group.find_by(name: 'Users')]) }
|
||||||
|
let!(:admin) { User.find_by(email: 'admin@example.com') }
|
||||||
|
|
||||||
it 'can subscribe and unsubscribe' do
|
it 'can subscribe and unsubscribe' do
|
||||||
ensure_websocket do
|
ensure_websocket do
|
||||||
|
@ -1400,8 +1401,9 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
# check history for mention entries
|
# check history for mention entries
|
||||||
click 'h2.sidebar-header-headline.js-headline'
|
click 'h2.sidebar-header-headline.js-headline'
|
||||||
click 'li[data-type=ticket-history] a'
|
click 'li[data-type=ticket-history] a'
|
||||||
expect(page).to have_text('created Mention')
|
expect(page).to have_text("created Mention → '#{admin.firstname} #{admin.lastname}'")
|
||||||
expect(page).to have_text('removed Mention')
|
expect(page).to have_text("removed Mention → '#{admin.firstname} #{admin.lastname}'")
|
||||||
|
expect(page).to have_text("created Mention → '#{other_agent.firstname} #{other_agent.lastname}'")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue