Commit f0a78f89 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix_duplicated_assignees_on_milestone_page' into 'master'

Fix: Milestone - Participants list is showing duplicate assignees

Closes #32690

See merge request !11758
parents 41a2b9da c3bca2ac
......@@ -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
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