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
a1684d14
Commit
a1684d14
authored
Jun 05, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify notification check for participating
parent
f7ec4df5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
13 deletions
+4
-13
app/models/notification_recipient.rb
app/models/notification_recipient.rb
+1
-7
app/models/notification_setting.rb
app/models/notification_setting.rb
+3
-6
No files found.
app/models/notification_recipient.rb
View file @
a1684d14
...
@@ -50,7 +50,7 @@ class NotificationRecipient
...
@@ -50,7 +50,7 @@ class NotificationRecipient
when
:mention
when
:mention
@type
==
:mention
@type
==
:mention
when
:participating
when
:participating
!
excluded_participating_action?
&&
%i[participating mention watch
]
.
include?
(
@type
)
@custom_action
==
:failed_pipeline
||
%i[participating mention
]
.
include?
(
@type
)
when
:custom
when
:custom
custom_enabled?
||
%i[participating mention]
.
include?
(
@type
)
custom_enabled?
||
%i[participating mention]
.
include?
(
@type
)
when
:watch
when
:watch
...
@@ -106,12 +106,6 @@ class NotificationRecipient
...
@@ -106,12 +106,6 @@ class NotificationRecipient
NotificationSetting
::
EXCLUDED_WATCHER_EVENTS
.
include?
(
@custom_action
)
NotificationSetting
::
EXCLUDED_WATCHER_EVENTS
.
include?
(
@custom_action
)
end
end
def
excluded_participating_action?
return
false
unless
@custom_action
NotificationSetting
::
EXCLUDED_PARTICIPATING_EVENTS
.
include?
(
@custom_action
)
end
private
private
def
read_ability
def
read_ability
...
...
app/models/notification_setting.rb
View file @
a1684d14
...
@@ -54,14 +54,11 @@ class NotificationSetting < ApplicationRecord
...
@@ -54,14 +54,11 @@ class NotificationSetting < ApplicationRecord
self
.
class
.
email_events
(
source
)
self
.
class
.
email_events
(
source
)
end
end
EXCLUDED_PARTICIPATING_EVENTS
=
[
:success_pipeline
].
freeze
EXCLUDED_WATCHER_EVENTS
=
[
EXCLUDED_WATCHER_EVENTS
=
[
:push_to_merge_request
,
:push_to_merge_request
,
:issue_due
:issue_due
,
].
push
(
*
EXCLUDED_PARTICIPATING_EVENTS
).
freeze
:success_pipeline
].
freeze
def
self
.
find_or_create_for
(
source
)
def
self
.
find_or_create_for
(
source
)
setting
=
find_or_initialize_by
(
source:
source
)
setting
=
find_or_initialize_by
(
source:
source
)
...
...
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