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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
65989141
Commit
65989141
authored
Jun 20, 2012
by
Robb Kidd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect IssueObserver#send_reassigned_email method.
parent
70c6b48e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
app/models/issue_observer.rb
app/models/issue_observer.rb
+2
-0
spec/models/issue_observer_spec.rb
spec/models/issue_observer_spec.rb
+3
-3
No files found.
app/models/issue_observer.rb
View file @
65989141
...
@@ -11,6 +11,8 @@ class IssueObserver < ActiveRecord::Observer
...
@@ -11,6 +11,8 @@ class IssueObserver < ActiveRecord::Observer
Note
.
create_status_change_note
(
issue
,
current_user
,
'reopened'
)
if
issue
.
is_being_reopened?
Note
.
create_status_change_note
(
issue
,
current_user
,
'reopened'
)
if
issue
.
is_being_reopened?
end
end
protected
def
send_reassigned_email
(
issue
)
def
send_reassigned_email
(
issue
)
recipient_ids
=
[
issue
.
assignee_id
,
issue
.
assignee_id_was
].
keep_if
{
|
id
|
id
!=
current_user
.
id
}
recipient_ids
=
[
issue
.
assignee_id
,
issue
.
assignee_id_was
].
keep_if
{
|
id
|
id
!=
current_user
.
id
}
...
...
spec/models/issue_observer_spec.rb
View file @
65989141
...
@@ -121,7 +121,7 @@ describe IssueObserver do
...
@@ -121,7 +121,7 @@ describe IssueObserver do
it_sends_a_reassigned_email_to
assignee
.
id
it_sends_a_reassigned_email_to
assignee
.
id
it_sends_a_reassigned_email_to
previous_assignee
.
id
it_sends_a_reassigned_email_to
previous_assignee
.
id
subject
.
send
_reassigned_email
(
issue
)
subject
.
send
(
:send_reassigned_email
,
issue
)
end
end
context
'does not send an email to the user who made the reassignment'
do
context
'does not send an email to the user who made the reassignment'
do
...
@@ -130,14 +130,14 @@ describe IssueObserver do
...
@@ -130,14 +130,14 @@ describe IssueObserver do
it_sends_a_reassigned_email_to
previous_assignee
.
id
it_sends_a_reassigned_email_to
previous_assignee
.
id
it_does_not_send_a_reassigned_email_to
assignee
.
id
it_does_not_send_a_reassigned_email_to
assignee
.
id
subject
.
send
_reassigned_email
(
issue
)
subject
.
send
(
:send_reassigned_email
,
issue
)
end
end
it
'if the user is the previous assignee'
do
it
'if the user is the previous assignee'
do
subject
.
stub
(
:current_user
).
and_return
(
previous_assignee
)
subject
.
stub
(
:current_user
).
and_return
(
previous_assignee
)
it_sends_a_reassigned_email_to
assignee
.
id
it_sends_a_reassigned_email_to
assignee
.
id
it_does_not_send_a_reassigned_email_to
previous_assignee
.
id
it_does_not_send_a_reassigned_email_to
previous_assignee
.
id
subject
.
send
_reassigned_email
(
issue
)
subject
.
send
(
:send_reassigned_email
,
issue
)
end
end
end
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