FIX: correctly update UI when post is assigned/unassigned (#233)
Update topic title, first post and related post
This commit is contained in:
parent
2d1f5668a5
commit
69dac06a82
|
@ -180,7 +180,11 @@ function initialize(api) {
|
|||
});
|
||||
api.attachWidgetAction("post", "unassignPost", function () {
|
||||
const taskActions = getOwner(this).lookup("service:task-actions");
|
||||
taskActions.unassign(this.model.id, "Post");
|
||||
taskActions.unassign(this.model.id, "Post").then(() => {
|
||||
delete this.model.topic.indirectly_assigned_to[
|
||||
this.model.post_number
|
||||
];
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -450,8 +454,11 @@ function initialize(api) {
|
|||
|
||||
if (data.post_id) {
|
||||
if (data.type === "unassigned") {
|
||||
delete topic.indirectly_assigned_to[data.post_id];
|
||||
delete topic.indirectly_assigned_to[data.post_number];
|
||||
}
|
||||
this.appEvents.trigger("post-stream:refresh", {
|
||||
id: topic.postStream.posts[0].id,
|
||||
});
|
||||
this.appEvents.trigger("post-stream:refresh", { id: data.post_id });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -222,6 +222,7 @@ class ::Assigner
|
|||
type: "assigned",
|
||||
topic_id: topic.id,
|
||||
post_id: post_target? && @target.id,
|
||||
post_number: post_target? && @target.post_number,
|
||||
assigned_type: type,
|
||||
assigned_to: serializer.new(assign_to, scope: Guardian.new, root: false).as_json
|
||||
},
|
||||
|
@ -375,6 +376,7 @@ class ::Assigner
|
|||
type: 'unassigned',
|
||||
topic_id: topic.id,
|
||||
post_id: post_target? && @target.id,
|
||||
post_number: post_target? && @target.post_number,
|
||||
assigned_type: assignment.assigned_to.is_a?(User) ? "User" : "Group"
|
||||
},
|
||||
user_ids: allowed_user_ids
|
||||
|
|
Loading…
Reference in New Issue