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
Léo-Paul Géneau
gitlab-ce
Commits
f7238306
Commit
f7238306
authored
Apr 26, 2019
by
Wei-Meng Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify logic using new group notification settings method
parent
03e08ab7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
17 deletions
+5
-17
app/models/notification_recipient.rb
app/models/notification_recipient.rb
+5
-17
No files found.
app/models/notification_recipient.rb
View file @
f7238306
...
...
@@ -156,23 +156,11 @@ class NotificationRecipient
# Returns the notification_setting of the lowest group in hierarchy with non global level
def
closest_non_global_group_notification_settting
return
unless
@group
return
if
indexed_group_notification_settings
.
empty?
notification_setting
=
nil
@group
.
self_and_ancestors_ids
.
each
do
|
id
|
notification_setting
=
indexed_group_notification_settings
[
id
]
break
if
notification_setting
end
notification_setting
end
def
indexed_group_notification_settings
strong_memoize
(
:indexed_group_notification_settings
)
do
@group
.
notification_settings
.
where
(
user_id:
user
.
id
)
.
where
.
not
(
level:
NotificationSetting
.
levels
[
:global
])
.
index_by
(
&
:source_id
)
end
@group
.
notification_settings
(
hierarchy_order: :asc
)
.
where
(
user:
user
)
.
where
.
not
(
level:
NotificationSetting
.
levels
[
:global
])
.
first
end
end
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