Commit c3bca2ac authored by Valery Sizov's avatar Valery Sizov

Fix: Milestone - Participants list is showing duplicate assignees

parent e5226177
...@@ -107,7 +107,7 @@ class Milestone < ActiveRecord::Base ...@@ -107,7 +107,7 @@ class Milestone < ActiveRecord::Base
end end
def participants def participants
User.joins(assigned_issues: :milestone).where("milestones.id = ?", id) User.joins(assigned_issues: :milestone).where("milestones.id = ?", id).uniq
end end
def self.sort(method) def self.sort(method)
......
...@@ -249,4 +249,17 @@ describe Milestone, models: true do ...@@ -249,4 +249,17 @@ describe Milestone, models: true do
expect(milestone.to_reference(another_project)).to eq "sample-project%1" expect(milestone.to_reference(another_project)).to eq "sample-project%1"
end end
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 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