diff --git a/assets/javascripts/discourse/components/topic-level-assign-menu.js b/assets/javascripts/discourse/components/topic-level-assign-menu.js index 942dd3ab..adc1d56b 100644 --- a/assets/javascripts/discourse/components/topic-level-assign-menu.js +++ b/assets/javascripts/discourse/components/topic-level-assign-menu.js @@ -65,7 +65,7 @@ export default { const topic = this.topic; if (topic.assigned_to_user || topic.hasAssignedPosts()) { - return unassignUsersButton(topic.assignees()); + return unassignUsersButton(topic.uniqueAssignees()); } else if (topic.assigned_to_group) { return unassignGroupButton(topic.assigned_to_group); } diff --git a/assets/javascripts/discourse/initializers/extend-for-assigns.js b/assets/javascripts/discourse/initializers/extend-for-assigns.js index 3e430b9a..dcde7df4 100644 --- a/assets/javascripts/discourse/initializers/extend-for-assigns.js +++ b/assets/javascripts/discourse/initializers/extend-for-assigns.js @@ -54,6 +54,12 @@ function extendTopicModel(api) { return result; }, + uniqueAssignees() { + const map = new Map(); + this.assignees().forEach((user) => map.set(user.username, user)); + return [...map.values()]; + }, + assignedPosts() { if (!this.indirectly_assigned_to) { return [];