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
Jérome Perrin
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
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
app/models/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
...
@@ -5,12 +5,18 @@ class NotificationRecipient
custom_action:
nil
,
custom_action:
nil
,
target:
nil
,
target:
nil
,
acting_user:
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
@custom_action
=
custom_action
@acting_user
=
acting_user
@acting_user
=
acting_user
@target
=
target
@target
=
target
@project
=
project
||
@target
&
.
project
@project
=
project
||
default_project
@group
=
group
||
@project
&
.
group
@user
=
user
@user
=
user
@type
=
type
@type
=
type
end
end
...
@@ -111,12 +117,18 @@ class NotificationRecipient
...
@@ -111,12 +117,18 @@ class NotificationRecipient
end
end
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
def
find_notification_setting
project_setting
=
@project
&&
user
.
notification_settings_for
(
@project
)
project_setting
=
@project
&&
user
.
notification_settings_for
(
@project
)
return
project_setting
unless
project_setting
.
nil?
||
project_setting
.
global?
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?
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