Commit ee6eb923 authored by Igor's avatar Igor Committed by Douwe Maan

Fix sorting by priority with filtering by approvers

parent dc832011
......@@ -36,7 +36,7 @@ module EE
class_methods do
def select_from_union(relations)
from_union(relations, remove_duplicates: true)
where(id: from_union(relations))
end
end
......
---
title: Fix sorting by priority with filtering by approvers
merge_request: 10446
author:
type: fixed
......@@ -133,4 +133,19 @@ describe MergeRequests::ByApproversFinder do
)
end
end
context 'filter by approvers' do
let(:mrs_by_ids) { merge_requests(ids: [first_user.id]) }
let(:mrs_by_usernames) { merge_requests(names: [first_user.username]) }
it 'can be ordered by popularity' do
expect(mrs_by_ids.sort_by_attribute("popularity")).to eq([merge_request_with_two_approvers, merge_request_with_approver])
expect(mrs_by_usernames.sort_by_attribute("popularity")).to eq([merge_request_with_two_approvers, merge_request_with_approver])
end
it 'can be ordered by priority' do
expect(mrs_by_usernames.sort_by_attribute("priority")).to eq([merge_request_with_two_approvers, merge_request_with_approver])
expect(mrs_by_ids.sort_by_attribute("priority")).to eq([merge_request_with_two_approvers, merge_request_with_approver])
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