diff --git a/assets/javascripts/discourse/services/task-actions.js b/assets/javascripts/discourse/services/task-actions.js index 1dc8c69c..673bdf89 100644 --- a/assets/javascripts/discourse/services/task-actions.js +++ b/assets/javascripts/discourse/services/task-actions.js @@ -46,7 +46,7 @@ export default class TaskActions extends Service { } unassignPost(postId) { - this.unassign(postId, "Post"); + return this.unassign(postId, "Post"); } showAssignModal( diff --git a/assets/javascripts/discourse/widgets/assigned-to.js b/assets/javascripts/discourse/widgets/assigned-to.js index f14d15d3..843274bc 100644 --- a/assets/javascripts/discourse/widgets/assigned-to.js +++ b/assets/javascripts/discourse/widgets/assigned-to.js @@ -38,13 +38,13 @@ export const AssignedToWidget = ["assigned-to", { "span", hbs` - - + `, { post: this.attrs.post, + unassign: () => this.unassign(), editAssignment: () => this.editAssignment() } ) @@ -56,5 +56,11 @@ export const AssignedToWidget = ["assigned-to", { taskActions.showAssignModal(this.attrs.post, { targetType: "Post", }); + }, + + unassign() { + const taskActions = getOwner(this).lookup("service:task-actions"); + const post = this.attrs.post; + taskActions.unassignPost(post.id).then(() => delete post.topic.indirectly_assigned_to[post.id]); } }];