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
Kazuhiko Shiozaki
gitlab-ce
Commits
1b437ec3
Commit
1b437ec3
authored
Mar 16, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests
parent
f53683e6
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
115 additions
and
25 deletions
+115
-25
app/assets/javascripts/subscription.js.coffee
app/assets/javascripts/subscription.js.coffee
+1
-2
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+3
-6
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+3
-6
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+7
-1
app/models/subscription.rb
app/models/subscription.rb
+13
-0
app/services/notification_service.rb
app/services/notification_service.rb
+3
-1
app/views/projects/issues/_issue_context.html.haml
app/views/projects/issues/_issue_context.html.haml
+3
-3
app/views/projects/merge_requests/show/_context.html.haml
app/views/projects/merge_requests/show/_context.html.haml
+3
-3
config/routes.rb
config/routes.rb
+2
-2
db/migrate/20150313012111_create_subscriptions_table.rb
db/migrate/20150313012111_create_subscriptions_table.rb
+4
-1
features/project/issues/issues.feature
features/project/issues/issues.feature
+8
-0
features/project/merge_requests.feature
features/project/merge_requests.feature
+7
-0
features/steps/project/issues/issues.rb
features/steps/project/issues/issues.rb
+13
-0
features/steps/project/merge_requests.rb
features/steps/project/merge_requests.rb
+13
-0
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+32
-0
No files found.
app/assets/javascripts/subscription.js.coffee
View file @
1b437ec3
class
@
Subscription
class
@
Subscription
constructor
:
(
url
)
->
constructor
:
(
url
)
->
$
(
".subscribe-button"
).
click
(
event
)
=>
$
(
".subscribe-button"
).
click
(
event
)
=>
self
=
@
btn
=
$
(
event
.
currentTarget
)
btn
=
$
(
event
.
currentTarget
)
action
=
btn
.
prop
(
"value"
)
action
=
btn
.
prop
(
"value"
)
current_status
=
$
(
".sub_status"
).
text
().
trim
()
current_status
=
$
(
".sub_status"
).
text
().
trim
()
$
(
".fa-spinner.subscription"
).
removeClass
(
"hidden"
)
$
(
".fa-spinner.subscription"
).
removeClass
(
"hidden"
)
$
(
".sub_status"
).
empty
()
$
(
".sub_status"
).
empty
()
$
.
post
url
,
subscription
:
action
,
=>
$
.
post
url
,
=>
$
(
".fa-spinner.subscription"
).
addClass
(
"hidden"
)
$
(
".fa-spinner.subscription"
).
addClass
(
"hidden"
)
status
=
if
current_status
==
"subscribed"
then
"unsubscribed"
else
"subscribed"
status
=
if
current_status
==
"subscribed"
then
"unsubscribed"
else
"subscribed"
$
(
".sub_status"
).
text
(
status
)
$
(
".sub_status"
).
text
(
status
)
...
...
app/controllers/projects/issues_controller.rb
View file @
1b437ec3
class
Projects::IssuesController
<
Projects
::
ApplicationController
class
Projects::IssuesController
<
Projects
::
ApplicationController
before_filter
:module_enabled
before_filter
:module_enabled
before_filter
:issue
,
only:
[
:edit
,
:update
,
:show
,
:
set
_subscription
]
before_filter
:issue
,
only:
[
:edit
,
:update
,
:show
,
:
toggle
_subscription
]
# Allow read any issue
# Allow read any issue
before_filter
:authorize_read_issue!
before_filter
:authorize_read_issue!
...
@@ -97,11 +97,8 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -97,11 +97,8 @@ class Projects::IssuesController < Projects::ApplicationController
redirect_to
:back
,
notice:
"
#{
result
[
:count
]
}
issues updated"
redirect_to
:back
,
notice:
"
#{
result
[
:count
]
}
issues updated"
end
end
def
set_subscription
def
toggle_subscription
subscribed
=
params
[
:subscription
]
==
"Subscribe"
@issue
.
toggle_subscription
(
current_user
)
sub
=
@issue
.
subscriptions
.
find_or_create_by
(
user_id:
current_user
.
id
)
sub
.
update
(
subscribed:
subscribed
)
render
nothing:
true
render
nothing:
true
end
end
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
1b437ec3
...
@@ -2,7 +2,7 @@ require 'gitlab/satellite/satellite'
...
@@ -2,7 +2,7 @@ require 'gitlab/satellite/satellite'
class
Projects::MergeRequestsController
<
Projects
::
ApplicationController
class
Projects::MergeRequestsController
<
Projects
::
ApplicationController
before_filter
:module_enabled
before_filter
:module_enabled
before_filter
:merge_request
,
only:
[
:edit
,
:update
,
:show
,
:diffs
,
:automerge
,
:automerge_check
,
:ci_status
,
:
set
_subscription
]
before_filter
:merge_request
,
only:
[
:edit
,
:update
,
:show
,
:diffs
,
:automerge
,
:automerge_check
,
:ci_status
,
:
toggle
_subscription
]
before_filter
:closes_issues
,
only:
[
:edit
,
:update
,
:show
,
:diffs
]
before_filter
:closes_issues
,
only:
[
:edit
,
:update
,
:show
,
:diffs
]
before_filter
:validates_merge_request
,
only:
[
:show
,
:diffs
]
before_filter
:validates_merge_request
,
only:
[
:show
,
:diffs
]
before_filter
:define_show_vars
,
only:
[
:show
,
:diffs
]
before_filter
:define_show_vars
,
only:
[
:show
,
:diffs
]
...
@@ -174,11 +174,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -174,11 +174,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
render
json:
response
render
json:
response
end
end
def
set_subscription
def
toggle_subscription
subscribed
=
params
[
:subscription
]
==
"Subscribe"
@merge_request
.
toggle_subscription
(
current_user
)
sub
=
@merge_request
.
subscriptions
.
find_or_create_by
(
user_id:
current_user
.
id
)
sub
.
update
(
subscribed:
subscribed
)
render
nothing:
true
render
nothing:
true
end
end
...
...
app/models/concerns/issuable.rb
View file @
1b437ec3
...
@@ -133,7 +133,7 @@ module Issuable
...
@@ -133,7 +133,7 @@ module Issuable
users
.
concat
(
mentions
.
reduce
([],
:|
)).
uniq
users
.
concat
(
mentions
.
reduce
([],
:|
)).
uniq
end
end
def
subscri
ption_status
(
user
)
def
subscri
bed?
(
user
)
subscription
=
subscriptions
.
find_by_user_id
(
user
.
id
)
subscription
=
subscriptions
.
find_by_user_id
(
user
.
id
)
if
subscription
if
subscription
...
@@ -143,6 +143,12 @@ module Issuable
...
@@ -143,6 +143,12 @@ module Issuable
participants
.
include?
(
user
)
participants
.
include?
(
user
)
end
end
def
toggle_subscription
(
user
)
subscriptions
.
find_or_initialize_by
(
user_id:
user
.
id
).
update
(
subscribed:
!
subscribed?
(
user
))
end
def
to_hook_data
(
user
)
def
to_hook_data
(
user
)
{
{
object_kind:
self
.
class
.
name
.
underscore
,
object_kind:
self
.
class
.
name
.
underscore
,
...
...
app/models/subscription.rb
View file @
1b437ec3
# == Schema Information
#
# Table name: subscriptions
#
# id :integer not null, primary key
# user_id :integer
# subscribable_id :integer
# subscribable_type :string(255)
# subscribed :boolean
# created_at :datetime
# updated_at :datetime
#
class
Subscription
<
ActiveRecord
::
Base
class
Subscription
<
ActiveRecord
::
Base
belongs_to
:user
belongs_to
:user
belongs_to
:subscribable
,
polymorphic:
true
belongs_to
:subscribable
,
polymorphic:
true
...
...
app/services/notification_service.rb
View file @
1b437ec3
...
@@ -92,6 +92,8 @@ class NotificationService
...
@@ -92,6 +92,8 @@ class NotificationService
#
#
def
merge_mr
(
merge_request
,
current_user
)
def
merge_mr
(
merge_request
,
current_user
)
recipients
=
reject_muted_users
([
merge_request
.
author
,
merge_request
.
assignee
],
merge_request
.
target_project
)
recipients
=
reject_muted_users
([
merge_request
.
author
,
merge_request
.
assignee
],
merge_request
.
target_project
)
recipients
=
add_subscribed_users
(
recipients
,
merge_request
)
recipients
=
reject_unsubscribed_users
(
recipients
,
merge_request
)
recipients
=
recipients
.
concat
(
project_watchers
(
merge_request
.
target_project
)).
uniq
recipients
=
recipients
.
concat
(
project_watchers
(
merge_request
.
target_project
)).
uniq
recipients
.
delete
(
current_user
)
recipients
.
delete
(
current_user
)
...
@@ -333,7 +335,7 @@ class NotificationService
...
@@ -333,7 +335,7 @@ class NotificationService
subscriptions
=
target
.
subscriptions
subscriptions
=
target
.
subscriptions
if
subscriptions
.
any?
if
subscriptions
.
any?
recipients
+
subscriptions
.
where
(
"subscribed is true"
).
map
(
&
:user
)
recipients
+
subscriptions
.
where
(
subscribed:
true
).
map
(
&
:user
)
else
else
recipients
recipients
end
end
...
...
app/views/projects/issues/_issue_context.html.haml
View file @
1b437ec3
...
@@ -33,12 +33,12 @@
...
@@ -33,12 +33,12 @@
Subscription:
Subscription:
%i
.fa.fa-spinner.fa-spin.hidden.subscription
%i
.fa.fa-spinner.fa-spin.hidden.subscription
%span
.sub_status
%span
.sub_status
=
@issue
.
subscri
ption_status
(
current_user
)
?
"subscribed"
:
"unsubscribed"
=
@issue
.
subscri
bed?
(
current_user
)
?
"subscribed"
:
"unsubscribed"
-
subscribe_action
=
@issue
.
subscri
ption_status
(
current_user
)
?
"Unsubscribe"
:
"Subscribe"
-
subscribe_action
=
@issue
.
subscri
bed?
(
current_user
)
?
"Unsubscribe"
:
"Subscribe"
%input
.btn.subscribe-button
{
:type
=>
"button"
,
:value
=>
subscribe_action
}
%input
.btn.subscribe-button
{
:type
=>
"button"
,
:value
=>
subscribe_action
}
:coffeescript
:coffeescript
$ ->
$ ->
new Subscription("
#{
set
_subscription_namespace_project_issue_path
(
@issue
.
project
.
namespace
,
@project
,
@issue
)
}
")
new Subscription("
#{
toggle
_subscription_namespace_project_issue_path
(
@issue
.
project
.
namespace
,
@project
,
@issue
)
}
")
\ No newline at end of file
app/views/projects/merge_requests/show/_context.html.haml
View file @
1b437ec3
...
@@ -35,12 +35,12 @@
...
@@ -35,12 +35,12 @@
Subscription:
Subscription:
%i
.fa.fa-spinner.fa-spin.hidden.subscription
%i
.fa.fa-spinner.fa-spin.hidden.subscription
%span
.sub_status
%span
.sub_status
=
@merge_request
.
subscri
ption_status
(
current_user
)
?
"subscribed"
:
"unsubscribed"
=
@merge_request
.
subscri
bed?
(
current_user
)
?
"subscribed"
:
"unsubscribed"
-
subscribe_action
=
@merge_request
.
subscri
ption_status
(
current_user
)
?
"Unsubscribe"
:
"Subscribe"
-
subscribe_action
=
@merge_request
.
subscri
bed?
(
current_user
)
?
"Unsubscribe"
:
"Subscribe"
%input
.btn.subscribe-button
{
:type
=>
"button"
,
:value
=>
subscribe_action
}
%input
.btn.subscribe-button
{
:type
=>
"button"
,
:value
=>
subscribe_action
}
:coffeescript
:coffeescript
$ ->
$ ->
new Subscription("
#{
set_subscription_namespace_project_issue
_path
(
@merge_request
.
project
.
namespace
,
@project
,
@merge_request
)
}
")
new Subscription("
#{
toggle_subscription_namespace_project_merge_request
_path
(
@merge_request
.
project
.
namespace
,
@project
,
@merge_request
)
}
")
\ No newline at end of file
config/routes.rb
View file @
1b437ec3
...
@@ -406,7 +406,7 @@ Gitlab::Application.routes.draw do
...
@@ -406,7 +406,7 @@ Gitlab::Application.routes.draw do
post
:automerge
post
:automerge
get
:automerge_check
get
:automerge_check
get
:ci_status
get
:ci_status
post
:
set
_subscription
post
:
toggle
_subscription
end
end
collection
do
collection
do
...
@@ -442,7 +442,7 @@ Gitlab::Application.routes.draw do
...
@@ -442,7 +442,7 @@ Gitlab::Application.routes.draw do
resources
:issues
,
constraints:
{
id:
/\d+/
},
except:
[
:destroy
]
do
resources
:issues
,
constraints:
{
id:
/\d+/
},
except:
[
:destroy
]
do
member
do
member
do
post
:
set
_subscription
post
:
toggle
_subscription
end
end
collection
do
collection
do
post
:bulk_update
post
:bulk_update
...
...
db/migrate/20150313012111_create_subscriptions_table.rb
View file @
1b437ec3
...
@@ -8,6 +8,9 @@ class CreateSubscriptionsTable < ActiveRecord::Migration
...
@@ -8,6 +8,9 @@ class CreateSubscriptionsTable < ActiveRecord::Migration
t
.
timestamps
t
.
timestamps
end
end
add_index
:subscriptions
,
[
:subscribable_id
,
:subscribable_type
,
:user_id
],
unique:
true
,
name:
'subscriptions_user_id_and_ref_fields'
add_index
:subscriptions
,
[
:subscribable_id
,
:subscribable_type
,
:user_id
],
unique:
true
,
name:
'subscriptions_user_id_and_ref_fields'
end
end
end
end
features/project/issues/issues.feature
View file @
1b437ec3
...
@@ -202,3 +202,11 @@ Feature: Project Issues
...
@@ -202,3 +202,11 @@ Feature: Project Issues
And
I click link
"Edit"
for the issue
And
I click link
"Edit"
for the issue
And I preview a description text like "Bug fixed
:
smile
:
"
And I preview a description text like "Bug fixed
:
smile
:
"
Then
I should see the Markdown write tab
Then
I should see the Markdown write tab
@javascript
Scenario
:
I
can unsubscribe from issue
Given
project
"Shop"
has
"Tasks-open"
open issue with task markdown
When
I visit issue page
"Tasks-open"
Then
I should see that I am subscribed
When
I click button
"Unsubscribe"
Then
I should see that I am unsubscribed
features/project/merge_requests.feature
View file @
1b437ec3
...
@@ -225,3 +225,10 @@ Feature: Project Merge Requests
...
@@ -225,3 +225,10 @@ Feature: Project Merge Requests
When
I fill in merge request search with
"Fe"
When
I fill in merge request search with
"Fe"
Then
I should see
"Feature NS-03"
in merge requests
Then
I should see
"Feature NS-03"
in merge requests
And
I should not see
"Bug NS-04"
in merge requests
And
I should not see
"Bug NS-04"
in merge requests
@javascript
Scenario
:
I
can unsubscribe from merge request
Given
I visit merge request page
"Bug NS-04"
Then
I should see that I am subscribed
When
I click button
"Unsubscribe"
Then
I should see that I am unsubscribed
features/steps/project/issues/issues.rb
View file @
1b437ec3
...
@@ -18,10 +18,23 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -18,10 +18,23 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
page
.
should_not
have_content
"Tweet control"
page
.
should_not
have_content
"Tweet control"
end
end
step
'I should see that I am subscribed'
do
find
(
".sub_status"
).
text
.
should
==
"subscribed"
end
step
'I should see that I am unsubscribed'
do
sleep
0.2
find
(
".sub_status"
).
text
.
should
==
"unsubscribed"
end
step
'I click link "Closed"'
do
step
'I click link "Closed"'
do
click_link
"Closed"
click_link
"Closed"
end
end
step
'I click button "Unsubscribe"'
do
click_on
"Unsubscribe"
end
step
'I should see "Release 0.3" in issues'
do
step
'I should see "Release 0.3" in issues'
do
page
.
should
have_content
"Release 0.3"
page
.
should
have_content
"Release 0.3"
end
end
...
...
features/steps/project/merge_requests.rb
View file @
1b437ec3
...
@@ -56,6 +56,19 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
...
@@ -56,6 +56,19 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
page
.
should_not
have_content
"Bug NS-04"
page
.
should_not
have_content
"Bug NS-04"
end
end
step
'I should see that I am subscribed'
do
find
(
".sub_status"
).
text
.
should
==
"subscribed"
end
step
'I should see that I am unsubscribed'
do
sleep
0.2
find
(
".sub_status"
).
text
.
should
==
"unsubscribed"
end
step
'I click button "Unsubscribe"'
do
click_on
"Unsubscribe"
end
step
'I click link "Close"'
do
step
'I click link "Close"'
do
first
(
:css
,
'.close-mr-link'
).
click
first
(
:css
,
'.close-mr-link'
).
click
end
end
...
...
spec/services/notification_service_spec.rb
View file @
1b437ec3
...
@@ -41,13 +41,18 @@ describe NotificationService do
...
@@ -41,13 +41,18 @@ describe NotificationService do
describe
:new_note
do
describe
:new_note
do
it
do
it
do
add_users_with_subscription
(
note
.
project
,
issue
)
should_email
(
@u_watcher
.
id
)
should_email
(
@u_watcher
.
id
)
should_email
(
note
.
noteable
.
author_id
)
should_email
(
note
.
noteable
.
author_id
)
should_email
(
note
.
noteable
.
assignee_id
)
should_email
(
note
.
noteable
.
assignee_id
)
should_email
(
@u_mentioned
.
id
)
should_email
(
@u_mentioned
.
id
)
should_email
(
@subscriber
.
id
)
should_not_email
(
note
.
author_id
)
should_not_email
(
note
.
author_id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
should_not_email
(
@u_disabled
.
id
)
should_not_email
(
@unsubscriber
.
id
)
notification
.
new_note
(
note
)
notification
.
new_note
(
note
)
end
end
...
@@ -191,6 +196,7 @@ describe NotificationService do
...
@@ -191,6 +196,7 @@ describe NotificationService do
before
do
before
do
build_team
(
issue
.
project
)
build_team
(
issue
.
project
)
add_users_with_subscription
(
issue
.
project
,
issue
)
end
end
describe
:new_issue
do
describe
:new_issue
do
...
@@ -224,6 +230,8 @@ describe NotificationService do
...
@@ -224,6 +230,8 @@ describe NotificationService do
should_email
(
issue
.
assignee_id
)
should_email
(
issue
.
assignee_id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@u_participant_mentioned
.
id
)
should_email
(
@u_participant_mentioned
.
id
)
should_email
(
@subscriber
.
id
)
should_not_email
(
@unsubscriber
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
should_not_email
(
@u_disabled
.
id
)
...
@@ -245,6 +253,8 @@ describe NotificationService do
...
@@ -245,6 +253,8 @@ describe NotificationService do
should_email
(
issue
.
author_id
)
should_email
(
issue
.
author_id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@u_participant_mentioned
.
id
)
should_email
(
@u_participant_mentioned
.
id
)
should_email
(
@subscriber
.
id
)
should_not_email
(
@unsubscriber
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
should_not_email
(
@u_disabled
.
id
)
...
@@ -266,6 +276,8 @@ describe NotificationService do
...
@@ -266,6 +276,8 @@ describe NotificationService do
should_email
(
issue
.
author_id
)
should_email
(
issue
.
author_id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@u_participant_mentioned
.
id
)
should_email
(
@u_participant_mentioned
.
id
)
should_email
(
@subscriber
.
id
)
should_not_email
(
@unsubscriber
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
should_not_email
(
@u_disabled
.
id
)
...
@@ -287,6 +299,7 @@ describe NotificationService do
...
@@ -287,6 +299,7 @@ describe NotificationService do
before
do
before
do
build_team
(
merge_request
.
target_project
)
build_team
(
merge_request
.
target_project
)
add_users_with_subscription
(
merge_request
.
target_project
,
merge_request
)
end
end
describe
:new_merge_request
do
describe
:new_merge_request
do
...
@@ -311,6 +324,8 @@ describe NotificationService do
...
@@ -311,6 +324,8 @@ describe NotificationService do
it
do
it
do
should_email
(
merge_request
.
assignee_id
)
should_email
(
merge_request
.
assignee_id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@subscriber
.
id
)
should_not_email
(
@unsubscriber
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
should_not_email
(
@u_disabled
.
id
)
notification
.
reassigned_merge_request
(
merge_request
,
merge_request
.
author
)
notification
.
reassigned_merge_request
(
merge_request
,
merge_request
.
author
)
...
@@ -329,6 +344,8 @@ describe NotificationService do
...
@@ -329,6 +344,8 @@ describe NotificationService do
it
do
it
do
should_email
(
merge_request
.
assignee_id
)
should_email
(
merge_request
.
assignee_id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@subscriber
.
id
)
should_not_email
(
@unsubscriber
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
should_not_email
(
@u_disabled
.
id
)
notification
.
close_mr
(
merge_request
,
@u_disabled
)
notification
.
close_mr
(
merge_request
,
@u_disabled
)
...
@@ -347,6 +364,8 @@ describe NotificationService do
...
@@ -347,6 +364,8 @@ describe NotificationService do
it
do
it
do
should_email
(
merge_request
.
assignee_id
)
should_email
(
merge_request
.
assignee_id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@subscriber
.
id
)
should_not_email
(
@unsubscriber
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
should_not_email
(
@u_disabled
.
id
)
notification
.
merge_mr
(
merge_request
,
@u_disabled
)
notification
.
merge_mr
(
merge_request
,
@u_disabled
)
...
@@ -365,6 +384,8 @@ describe NotificationService do
...
@@ -365,6 +384,8 @@ describe NotificationService do
it
do
it
do
should_email
(
merge_request
.
assignee_id
)
should_email
(
merge_request
.
assignee_id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@u_watcher
.
id
)
should_email
(
@subscriber
.
id
)
should_not_email
(
@unsubscriber
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
should_not_email
(
@u_disabled
.
id
)
notification
.
reopen_mr
(
merge_request
,
@u_disabled
)
notification
.
reopen_mr
(
merge_request
,
@u_disabled
)
...
@@ -420,4 +441,15 @@ describe NotificationService do
...
@@ -420,4 +441,15 @@ describe NotificationService do
project
.
team
<<
[
@u_mentioned
,
:master
]
project
.
team
<<
[
@u_mentioned
,
:master
]
project
.
team
<<
[
@u_committer
,
:master
]
project
.
team
<<
[
@u_committer
,
:master
]
end
end
def
add_users_with_subscription
(
project
,
issuable
)
@subscriber
=
create
:user
@unsubscriber
=
create
:user
project
.
team
<<
[
@subscriber
,
:master
]
project
.
team
<<
[
@unsubscriber
,
:master
]
issuable
.
subscriptions
.
create
(
user:
@subscriber
,
subscribed:
true
)
issuable
.
subscriptions
.
create
(
user:
@unsubscriber
,
subscribed:
false
)
end
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