Commit 057df5a3 authored by Sean McGivern's avatar Sean McGivern Committed by Mayra Cabrera

Do not persist translated system notes

parent 7225162f
...@@ -67,7 +67,7 @@ module SystemNoteService ...@@ -67,7 +67,7 @@ module SystemNoteService
create_note(NoteSummary.new(noteable, project, author, body, action: 'assignee')) create_note(NoteSummary.new(noteable, project, author, body, action: 'assignee'))
end end
# Called when the assignees of an Issue is changed or removed # Called when the assignees of an issuable is changed or removed
# #
# issuable - Issuable object (responds to assignees) # issuable - Issuable object (responds to assignees)
# project - Project owning noteable # project - Project owning noteable
...@@ -88,10 +88,12 @@ module SystemNoteService ...@@ -88,10 +88,12 @@ module SystemNoteService
def change_issuable_assignees(issuable, project, author, old_assignees) def change_issuable_assignees(issuable, project, author, old_assignees)
unassigned_users = old_assignees - issuable.assignees unassigned_users = old_assignees - issuable.assignees
added_users = issuable.assignees.to_a - old_assignees added_users = issuable.assignees.to_a - old_assignees
text_parts = [] text_parts = []
text_parts << "assigned to #{added_users.map(&:to_reference).to_sentence}" if added_users.any?
text_parts << "unassigned #{unassigned_users.map(&:to_reference).to_sentence}" if unassigned_users.any? Gitlab::I18n.with_default_locale do
text_parts << "assigned to #{added_users.map(&:to_reference).to_sentence}" if added_users.any?
text_parts << "unassigned #{unassigned_users.map(&:to_reference).to_sentence}" if unassigned_users.any?
end
body = text_parts.join(' and ') body = text_parts.join(' and ')
......
---
title: Do not translate system notes into author's language
merge_request: 32264
author:
type: fixed
...@@ -212,6 +212,13 @@ describe SystemNoteService do ...@@ -212,6 +212,13 @@ describe SystemNoteService do
expect(build_note([assignee, assignee1, assignee2], [assignee, assignee1])).to eq \ expect(build_note([assignee, assignee1, assignee2], [assignee, assignee1])).to eq \
"unassigned @#{assignee2.username}" "unassigned @#{assignee2.username}"
end end
it 'builds a correct phrase when the locale is different' do
Gitlab::I18n.with_locale('pt-BR') do
expect(build_note([assignee, assignee1, assignee2], [assignee3])).to eq \
"assigned to @#{assignee3.username} and unassigned @#{assignee.username}, @#{assignee1.username}, and @#{assignee2.username}"
end
end
end end
describe '.change_milestone' do describe '.change_milestone' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment