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
19309b97
Commit
19309b97
authored
Jul 31, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
default the project to target.project
parent
3829d724
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
app/models/notification_recipient.rb
app/models/notification_recipient.rb
+9
-3
app/services/notification_recipient_service.rb
app/services/notification_recipient_service.rb
+2
-1
app/services/notification_service.rb
app/services/notification_service.rb
+2
-2
No files found.
app/models/notification_recipient.rb
View file @
19309b97
class
NotificationRecipient
class
NotificationRecipient
attr_reader
:user
,
:project
,
:type
attr_reader
:user
,
:project
,
:type
def
initialize
(
user
,
project
,
type
,
def
initialize
(
user
,
type
,
custom_action:
nil
,
target:
nil
,
acting_user:
nil
,
read_ability:
nil
)
custom_action:
nil
,
@project
=
project
target:
nil
,
acting_user:
nil
,
read_ability:
nil
,
project:
nil
)
@custom_action
=
custom_action
@custom_action
=
custom_action
@acting_user
=
acting_user
@acting_user
=
acting_user
@read_ability
=
read_ability
@read_ability
=
read_ability
@target
=
target
@target
=
target
@project
=
project
||
@target
&
.
project
@user
=
user
@user
=
user
@type
=
type
@type
=
type
raise
ArgumentError
,
"Project is missing"
if
@project
.
nil?
end
end
def
notification_setting
def
notification_setting
...
...
app/services/notification_recipient_service.rb
View file @
19309b97
...
@@ -56,7 +56,8 @@ module NotificationRecipientService
...
@@ -56,7 +56,8 @@ module NotificationRecipientService
end
end
def
make_recipient
(
user
,
type
)
def
make_recipient
(
user
,
type
)
NotificationRecipient
.
new
(
user
,
project
,
type
,
NotificationRecipient
.
new
(
user
,
type
,
project:
project
,
custom_action:
custom_action
,
custom_action:
custom_action
,
target:
target
,
target:
target
,
acting_user:
acting_user
,
acting_user:
acting_user
,
...
...
app/services/notification_service.rb
View file @
19309b97
...
@@ -272,7 +272,7 @@ class NotificationService
...
@@ -272,7 +272,7 @@ class NotificationService
end
end
def
project_was_moved
(
project
,
old_path_with_namespace
)
def
project_was_moved
(
project
,
old_path_with_namespace
)
recipients
=
NotificationRecipientService
.
notifiable_users
(
project
.
team
.
members
,
project
,
:mention
)
recipients
=
NotificationRecipientService
.
notifiable_users
(
project
.
team
.
members
,
:mention
,
project:
project
)
recipients
.
each
do
|
recipient
|
recipients
.
each
do
|
recipient
|
mailer
.
project_was_moved_email
(
mailer
.
project_was_moved_email
(
...
@@ -307,7 +307,7 @@ class NotificationService
...
@@ -307,7 +307,7 @@ class NotificationService
return
unless
mailer
.
respond_to?
(
email_template
)
return
unless
mailer
.
respond_to?
(
email_template
)
recipients
||=
NotificationRecipientService
.
notifiable_users
(
recipients
||=
NotificationRecipientService
.
notifiable_users
(
[
pipeline
.
user
],
pipeline
.
project
,
:watch
,
[
pipeline
.
user
],
:watch
,
custom_action: :"
#{
pipeline
.
status
}
_pipeline"
,
custom_action: :"
#{
pipeline
.
status
}
_pipeline"
,
read_ability: :read_build
,
read_ability: :read_build
,
target:
pipeline
target:
pipeline
...
...
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