Skip to content

Commit

Permalink
Do not duplicate avatars when topic and posts are assigned to the sam…
Browse files Browse the repository at this point in the history
…e user
  • Loading branch information
AndrewPrigorshnev committed Mar 26, 2024
1 parent 884921c commit 1ca5dfa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
Expand Down

0 comments on commit 1ca5dfa

Please sign in to comment.