Merge branch 'fix_duplicated_assignees_on_milestone_page' into 'master'
Fix: Milestone - Participants list is showing duplicate assignees Closes #32690 See merge request !11758
This commit is contained in:
commit
f0a78f89cd
2 changed files with 14 additions and 1 deletions
|
@ -107,7 +107,7 @@ class Milestone < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def participants
|
||||
User.joins(assigned_issues: :milestone).where("milestones.id = ?", id)
|
||||
User.joins(assigned_issues: :milestone).where("milestones.id = ?", id).uniq
|
||||
end
|
||||
|
||||
def self.sort(method)
|
||||
|
|
|
@ -249,4 +249,17 @@ describe Milestone, models: true do
|
|||
expect(milestone.to_reference(another_project)).to eq "sample-project%1"
|
||||
end
|
||||
end
|
||||
|
||||
describe '#participants' do
|
||||
let(:project) { build(:empty_project, name: 'sample-project') }
|
||||
let(:milestone) { build(:milestone, iid: 1, project: project) }
|
||||
|
||||
it 'returns participants without duplicates' do
|
||||
user = create :user
|
||||
create :issue, project: project, milestone: milestone, assignees: [user]
|
||||
create :issue, project: project, milestone: milestone, assignees: [user]
|
||||
|
||||
expect(milestone.participants).to eq [user]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue