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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
48707d21
Commit
48707d21
authored
Dec 02, 2020
by
David Kim
Committed by
James Lopez
Dec 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix notification_event_name for dynamic email events
Also, adds missing i18n entries that needs to be translated.
parent
4454cd3e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
8 deletions
+34
-8
app/helpers/notifications_helper.rb
app/helpers/notifications_helper.rb
+2
-1
app/models/notification_setting.rb
app/models/notification_setting.rb
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+12
-0
locale/unfound_translations.rb
locale/unfound_translations.rb
+6
-2
spec/helpers/notifications_helper_spec.rb
spec/helpers/notifications_helper_spec.rb
+13
-4
No files found.
app/helpers/notifications_helper.rb
View file @
48707d21
...
...
@@ -106,7 +106,8 @@ module NotificationsHelper
when
:success_pipeline
s_
(
'NotificationEvent|Successful pipeline'
)
else
s_
(
event
.
to_s
.
humanize
)
event_name
=
"NotificationEvent|
#{
event
.
to_s
.
humanize
}
"
s_
(
event_name
)
end
end
...
...
app/models/notification_setting.rb
View file @
48707d21
...
...
@@ -30,6 +30,7 @@ class NotificationSetting < ApplicationRecord
scope
:preload_source_route
,
->
{
preload
(
source:
[
:route
])
}
# NOTE: Applicable unfound_translations.rb also needs to be updated when below events are changed.
EMAIL_EVENTS
=
[
:new_release
,
:new_note
,
...
...
@@ -51,7 +52,6 @@ class NotificationSetting < ApplicationRecord
:moved_project
].
freeze
# Update unfound_translations.rb when events are changed
def
self
.
email_events
(
source
=
nil
)
EMAIL_EVENTS
end
...
...
locale/gitlab.pot
View file @
48707d21
...
...
@@ -18847,9 +18847,15 @@ msgstr ""
msgid "NotificationEvent|Fixed pipeline"
msgstr ""
msgid "NotificationEvent|Issue due"
msgstr ""
msgid "NotificationEvent|Merge merge request"
msgstr ""
msgid "NotificationEvent|Moved project"
msgstr ""
msgid "NotificationEvent|New epic"
msgstr ""
...
...
@@ -18865,6 +18871,9 @@ msgstr ""
msgid "NotificationEvent|New release"
msgstr ""
msgid "NotificationEvent|Push to merge request"
msgstr ""
msgid "NotificationEvent|Reassign issue"
msgstr ""
...
...
@@ -18874,6 +18883,9 @@ msgstr ""
msgid "NotificationEvent|Reopen issue"
msgstr ""
msgid "NotificationEvent|Reopen merge request"
msgstr ""
msgid "NotificationEvent|Successful pipeline"
msgstr ""
...
...
locale/unfound_translations.rb
View file @
48707d21
...
...
@@ -4,16 +4,20 @@
# https://github.com/grosser/gettext_i18n_rails#unfound-translations-with-rake-gettextfind
# NotificationSetting.email_events
N_
(
'NotificationEvent|New release'
)
N_
(
'NotificationEvent|New note'
)
N_
(
'NotificationEvent|New issue'
)
N_
(
'NotificationEvent|Reopen issue'
)
N_
(
'NotificationEvent|Close issue'
)
N_
(
'NotificationEvent|Reassign issue'
)
N_
(
'NotificationEvent|Issue due'
)
N_
(
'NotificationEvent|New merge request'
)
N_
(
'NotificationEvent|Push to merge request'
)
N_
(
'NotificationEvent|Reopen merge request'
)
N_
(
'NotificationEvent|Close merge request'
)
N_
(
'NotificationEvent|Reassign merge request'
)
N_
(
'NotificationEvent|Change reviewer merge request'
)
N_
(
'NotificationEvent|Merge merge request'
)
N_
(
'NotificationEvent|Failed pipeline'
)
N_
(
'NotificationEvent|Fixed pipeline'
)
N_
(
'NotificationEvent|New release'
)
N_
(
'NotificationEvent|Change reviewer merge request'
)
N_
(
'NotificationEvent|Moved project'
)
spec/helpers/notifications_helper_spec.rb
View file @
48707d21
...
...
@@ -20,10 +20,19 @@ RSpec.describe NotificationsHelper do
end
describe
'#notification_event_name'
do
it
{
expect
(
notification_event_name
(
:success_pipeline
)).
to
match
(
'Successful pipeline'
)
}
it
{
expect
(
notification_event_name
(
:failed_pipeline
)).
to
match
(
'Failed pipeline'
)
}
it
{
expect
(
notification_event_name
(
:fixed_pipeline
)).
to
match
(
'Fixed pipeline'
)
}
it
{
expect
(
notification_event_name
(
:moved_project
)).
to
match
(
'Moved project'
)
}
context
'for success_pipeline'
do
it
'returns the custom name'
do
expect
(
FastGettext
).
to
receive
(
:cached_find
).
with
(
'NotificationEvent|Successful pipeline'
)
expect
(
notification_event_name
(
:success_pipeline
)).
to
eq
(
'Successful pipeline'
)
end
end
context
'for everything else'
do
it
'returns a humanized name'
do
expect
(
FastGettext
).
to
receive
(
:cached_find
).
with
(
'NotificationEvent|Failed pipeline'
)
expect
(
notification_event_name
(
:failed_pipeline
)).
to
eq
(
'Failed pipeline'
)
end
end
end
describe
'#notification_icon_level'
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