Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
057df5a3
Commit
057df5a3
authored
Aug 27, 2019
by
Sean McGivern
Committed by
Mayra Cabrera
Aug 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not persist translated system notes
parent
7225162f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
+18
-4
app/services/system_note_service.rb
app/services/system_note_service.rb
+6
-4
changelogs/unreleased/63262-notes-are-persisted-with-the-user-s-locale.yml
...ased/63262-notes-are-persisted-with-the-user-s-locale.yml
+5
-0
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+7
-0
No files found.
app/services/system_note_service.rb
View file @
057df5a3
...
...
@@ -67,7 +67,7 @@ module SystemNoteService
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'assignee'
))
end
# Called when the assignees of an
Issu
e is changed or removed
# Called when the assignees of an
issuabl
e is changed or removed
#
# issuable - Issuable object (responds to assignees)
# project - Project owning noteable
...
...
@@ -88,10 +88,12 @@ module SystemNoteService
def
change_issuable_assignees
(
issuable
,
project
,
author
,
old_assignees
)
unassigned_users
=
old_assignees
-
issuable
.
assignees
added_users
=
issuable
.
assignees
.
to_a
-
old_assignees
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 '
)
...
...
changelogs/unreleased/63262-notes-are-persisted-with-the-user-s-locale.yml
0 → 100644
View file @
057df5a3
---
title
:
Do not translate system notes into author's language
merge_request
:
32264
author
:
type
:
fixed
spec/services/system_note_service_spec.rb
View file @
057df5a3
...
...
@@ -212,6 +212,13 @@ describe SystemNoteService do
expect
(
build_note
([
assignee
,
assignee1
,
assignee2
],
[
assignee
,
assignee1
])).
to
eq
\
"unassigned @
#{
assignee2
.
username
}
"
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
describe
'.change_milestone'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment