mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
DEV: Add extra appEvents to composer workflow
* add composer:saved, composer:created-post, and composer:edited-post appEvents inside the composer controller, to make it easier to detect these events in plugins
This commit is contained in:
parent
9075d5a9f5
commit
280cd99c62
@ -690,6 +690,8 @@ export default Controller.extend({
|
|||||||
const promise = composer
|
const promise = composer
|
||||||
.save({ imageSizes, editReason: this.editReason })
|
.save({ imageSizes, editReason: this.editReason })
|
||||||
.then(result => {
|
.then(result => {
|
||||||
|
this.appEvents.trigger("composer:saved");
|
||||||
|
|
||||||
if (result.responseJson.action === "enqueued") {
|
if (result.responseJson.action === "enqueued") {
|
||||||
this.send("postWasEnqueued", result.responseJson);
|
this.send("postWasEnqueued", result.responseJson);
|
||||||
if (result.responseJson.pending_post) {
|
if (result.responseJson.pending_post) {
|
||||||
@ -707,6 +709,7 @@ export default Controller.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.get("model.editingPost")) {
|
if (this.get("model.editingPost")) {
|
||||||
|
this.appEvents.trigger("composer:edited-post");
|
||||||
this.appEvents.trigger("post-stream:refresh", {
|
this.appEvents.trigger("post-stream:refresh", {
|
||||||
id: parseInt(result.responseJson.id, 10)
|
id: parseInt(result.responseJson.id, 10)
|
||||||
});
|
});
|
||||||
@ -718,6 +721,7 @@ export default Controller.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result.responseJson.action === "create_post") {
|
if (result.responseJson.action === "create_post") {
|
||||||
|
this.appEvents.trigger("composer:created-post");
|
||||||
this.appEvents.trigger("post:highlight", result.payload.post_number);
|
this.appEvents.trigger("post:highlight", result.payload.post_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user