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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
1fc42d99
Commit
1fc42d99
authored
Jan 15, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'improve/notification' of /home/git/repositories/gitlab/gitlabhq
parents
065d9c22
2e7abbd6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
3 deletions
+35
-3
app/models/project.rb
app/models/project.rb
+1
-3
app/services/notification_service.rb
app/services/notification_service.rb
+9
-0
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+25
-0
No files found.
app/models/project.rb
View file @
1fc42d99
...
...
@@ -270,9 +270,7 @@ class Project < ActiveRecord::Base
end
def
send_move_instructions
team
.
members
.
each
do
|
user
|
Notify
.
delay
.
project_was_moved_email
(
self
.
id
,
user
.
id
)
end
NotificationService
.
new
.
project_was_moved
(
self
)
end
def
owner
...
...
app/services/notification_service.rb
View file @
1fc42d99
...
...
@@ -157,6 +157,15 @@ class NotificationService
mailer
.
group_access_granted_email
(
users_group
.
id
)
end
def
project_was_moved
(
project
)
recipients
=
project
.
team
.
members
recipients
=
reject_muted_users
(
recipients
,
project
)
recipients
.
each
do
|
recipient
|
mailer
.
project_was_moved_email
(
project
.
id
,
recipient
.
id
)
end
end
protected
# Get project users with WATCH notification level
...
...
spec/services/notification_service_spec.rb
View file @
1fc42d99
...
...
@@ -233,6 +233,31 @@ describe NotificationService do
end
end
describe
'Projects'
do
let
(
:project
)
{
create
:project
}
before
do
build_team
(
project
)
end
describe
:project_was_moved
do
it
do
should_email
(
@u_watcher
.
id
)
should_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
notification
.
project_was_moved
(
project
)
end
def
should_email
(
user_id
)
Notify
.
should_receive
(
:project_was_moved_email
).
with
(
project
.
id
,
user_id
)
end
def
should_not_email
(
user_id
)
Notify
.
should_not_receive
(
:project_was_moved_email
).
with
(
project
.
id
,
user_id
)
end
end
end
def
build_team
(
project
)
@u_watcher
=
create
(
:user
,
notification_level:
Notification
::
N_WATCH
)
@u_participating
=
create
(
:user
,
notification_level:
Notification
::
N_PARTICIPATING
)
...
...
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