FIX: Refresh first post after assign and unassign (#212)
The first post showed the assign status when it was loaded and did not update if it changed. The page had to be refreshed for the text to be updated.
This commit is contained in:
parent
7082e32122
commit
85fa1f90aa
|
@ -91,16 +91,21 @@ function registerTopicFooterButtons(api) {
|
||||||
|
|
||||||
const taskActions = getOwner(this).lookup("service:task-actions");
|
const taskActions = getOwner(this).lookup("service:task-actions");
|
||||||
const topic = this.topic;
|
const topic = this.topic;
|
||||||
const assignedUser = topic.get("assigned_to_user.username");
|
|
||||||
|
|
||||||
if (assignedUser) {
|
if (topic.assigned_to_user || topic.assigned_to_group) {
|
||||||
this.set("topic.assigned_to_user", null);
|
this.set("topic.assigned_to_user", null);
|
||||||
taskActions.unassign(topic.id);
|
|
||||||
} else if (topic.assigned_to_group) {
|
|
||||||
this.set("topic.assigned_to_group", null);
|
this.set("topic.assigned_to_group", null);
|
||||||
taskActions.unassign(topic.id);
|
taskActions.unassign(topic.id).then(() => {
|
||||||
|
this.appEvents.trigger("post-stream:refresh", {
|
||||||
|
id: topic.postStream.firstPostId,
|
||||||
|
});
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
taskActions.assign(topic);
|
taskActions.assign(topic).set("model.onSuccess", () => {
|
||||||
|
this.appEvents.trigger("post-stream:refresh", {
|
||||||
|
id: topic.postStream.firstPostId,
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dropdown() {
|
dropdown() {
|
||||||
|
|
Loading…
Reference in New Issue