Commit 0f3df62e authored by Josh Frye's avatar Josh Frye

Update specs. Add CHANGELOG entry

parent 8835b788
...@@ -27,6 +27,7 @@ v 8.9.0 (unreleased) ...@@ -27,6 +27,7 @@ v 8.9.0 (unreleased)
- Measure queue duration between gitlab-workhorse and Rails - Measure queue duration between gitlab-workhorse and Rails
- Make authentication service for Container Registry to be compatible with < Docker 1.11 - Make authentication service for Container Registry to be compatible with < Docker 1.11
- Add Application Setting to configure Container Registry token expire delay (default 5min) - Add Application Setting to configure Container Registry token expire delay (default 5min)
- Cache assigned issue and merge request counts in sidebar nav
v 8.8.3 v 8.8.3
- Fix incorrect links on pipeline page when merge request created from fork - Fix incorrect links on pipeline page when merge request created from fork
......
...@@ -74,7 +74,7 @@ module Issuable ...@@ -74,7 +74,7 @@ module Issuable
def update_assignee_cache_counts def update_assignee_cache_counts
# make sure we flush the cache for both the old *and* new assignee # 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 User.find(assignee_id_was).update_cache_counts if assignee_id_was
assignee.update_cache_counts if assignee_id assignee.update_cache_counts if assignee
end end
end end
......
...@@ -62,21 +62,6 @@ describe 'Issues', feature: true do ...@@ -62,21 +62,6 @@ describe 'Issues', feature: true do
expect(issue.reload.assignee).to be_nil expect(issue.reload.assignee).to be_nil
end end
it 'updates assigned cache count on change', js: true do
visit edit_namespace_project_issue_path(project.namespace, project, issue)
expect(page).to have_content "Assignee #{@user.name}"
expect(@user.assigned_open_issues_count).to eq @user.assigned_issues.opened.count
first('#s2id_issue_assignee_id').click
sleep 2 # wait for ajax stuff to complete
first('.user-result').click
click_button 'Save changes'
expect(@user.assigned_open_issues_count).to eq @user.assigned_issues.opened.count
end
end end
describe 'due date', js: true do describe 'due date', js: true do
......
...@@ -269,4 +269,21 @@ describe Issue, models: true do ...@@ -269,4 +269,21 @@ describe Issue, models: true do
end end
end end
end end
describe 'cached counts' do
it 'updates when assignees change' do
user1 = create(:user)
user2 = create(:user)
issue = create(:issue, assignee: user1)
expect(user1.assigned_open_issues_count).to eq(1)
expect(user2.assigned_open_issues_count).to eq(0)
issue.assignee = user2
issue.save
expect(user1.assigned_open_issues_count).to eq(0)
expect(user2.assigned_open_issues_count).to eq(1)
end
end
end end
...@@ -438,4 +438,21 @@ describe MergeRequest, models: true do ...@@ -438,4 +438,21 @@ describe MergeRequest, models: true do
expect(mr.participants).to include(note1.author, note2.author) expect(mr.participants).to include(note1.author, note2.author)
end end
end end
describe 'cached counts' do
it 'updates when assignees change' do
user1 = create(:user)
user2 = create(:user)
mr = create(:merge_request, assignee: user1)
expect(user1.assigned_open_merge_request_count).to eq(1)
expect(user2.assigned_open_merge_request_count).to eq(0)
mr.assignee = user2
mr.save
expect(user1.assigned_open_merge_request_count).to eq(0)
expect(user2.assigned_open_merge_request_count).to eq(1)
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment