BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7e7f602d
Commit
7e7f602d
authored
Aug 04, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make NotificationRecipient a little more customizable
parent
1c874f71
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
notification_recipient.rb
app/models/notification_recipient.rb
+15
-3
No files found.
app/models/notification_recipient.rb
View file @
7e7f602d
...
...
@@ -5,12 +5,18 @@ class NotificationRecipient
custom_action:
nil
,
target:
nil
,
acting_user:
nil
,
project:
nil
project:
nil
,
group:
nil
)
unless
NotificationSetting
.
levels
.
key?
(
type
)
||
type
==
:subscription
raise
ArgumentError
,
"invalid type:
#{
type
.
inspect
}
"
end
@custom_action
=
custom_action
@acting_user
=
acting_user
@target
=
target
@project
=
project
||
@target
&
.
project
@project
=
project
||
default_project
@group
=
group
||
@project
&
.
group
@user
=
user
@type
=
type
end
...
...
@@ -111,12 +117,18 @@ class NotificationRecipient
end
end
def
default_project
return
nil
if
@target
.
nil?
return
@target
if
@target
.
is_a?
(
Project
)
return
@target
.
project
if
@target
.
respond_to?
(
:project
)
end
def
find_notification_setting
project_setting
=
@project
&&
user
.
notification_settings_for
(
@project
)
return
project_setting
unless
project_setting
.
nil?
||
project_setting
.
global?
group_setting
=
@
project
&
.
group
&&
user
.
notification_settings_for
(
@project
.
group
)
group_setting
=
@
group
&&
user
.
notification_settings_for
(
@
group
)
return
group_setting
unless
group_setting
.
nil?
||
group_setting
.
global?
...
...
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