DEV: add appEvent for solution-toggled (#273)

This commit is contained in:
Kris 2023-12-20 11:58:47 -05:00 committed by GitHub
parent 5c84152b06
commit dd8ebd24e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -173,6 +173,8 @@ function initializeWithApi(api) {
const post = this.model; const post = this.model;
acceptPost(post); acceptPost(post);
this.appEvents.trigger("discourse-solved:solution-toggled", post);
post.get("topic.postStream.posts").forEach((p) => { post.get("topic.postStream.posts").forEach((p) => {
p.set("topic_accepted_answer", true); p.set("topic_accepted_answer", true);
this.appEvents.trigger("post-stream:refresh", { id: p.id }); this.appEvents.trigger("post-stream:refresh", { id: p.id });
@ -183,6 +185,8 @@ function initializeWithApi(api) {
const post = this.model; const post = this.model;
unacceptPost(post); unacceptPost(post);
this.appEvents.trigger("discourse-solved:solution-toggled", post);
post.get("topic.postStream.posts").forEach((p) => { post.get("topic.postStream.posts").forEach((p) => {
p.set("topic_accepted_answer", false); p.set("topic_accepted_answer", false);
this.appEvents.trigger("post-stream:refresh", { id: p.id }); this.appEvents.trigger("post-stream:refresh", { id: p.id });