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
Boxiang Sun
gitlab-ce
Commits
77deeb12
Commit
77deeb12
authored
Dec 14, 2016
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issuable assignee update bug when previous assignee is null
parent
b6d069c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+4
-3
changelogs/unreleased/issue_22664.yml
changelogs/unreleased/issue_22664.yml
+4
-0
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+20
-0
No files found.
app/models/concerns/issuable.rb
View file @
77deeb12
...
...
@@ -92,9 +92,10 @@ module Issuable
after_save
:record_metrics
def
update_assignee_cache_counts
# make sure we flush the cache for both the old *and* new assignee
User
.
find
(
assignee_id_was
).
update_cache_counts
if
assignee_id_was
assignee
.
update_cache_counts
if
assignee
# make sure we flush the cache for both the old *and* new assignees(if they exist)
previous_assignee
=
User
.
find_by_id
(
assignee_id_was
)
previous_assignee
.
try
(
:update_cache_counts
)
assignee
.
try
(
:update_cache_counts
)
end
# We want to use optimistic lock for cases when only title or description are involved
...
...
changelogs/unreleased/issue_22664.yml
0 → 100644
View file @
77deeb12
---
title
:
Fix issuable assignee update bug when previous assignee is
null
merge_request
:
author
:
spec/models/concerns/issuable_spec.rb
View file @
77deeb12
...
...
@@ -44,6 +44,26 @@ describe Issue, "Issuable" do
it
{
expect
(
described_class
).
to
respond_to
(
:assigned
)
}
end
describe
"after_save"
do
describe
"#update_cache_counts"
do
context
"when previous assignee exists"
do
it
"user updates cache counts"
do
expect
(
user
).
to
receive
(
:update_cache_counts
)
issue
.
update
(
assignee:
user
)
end
end
context
"when previous assignee does not exist"
do
it
"does not raise error"
do
issue
.
update
(
assignee_id:
""
)
expect
{
issue
.
update
(
assignee_id:
user
)
}.
not_to
raise_error
end
end
end
end
describe
".search"
do
let!
(
:searchable_issue
)
{
create
(
:issue
,
title:
"Searchable issue"
)
}
...
...
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