diff --git a/assets/javascripts/discourse/components/solved-accept-answer-button.gjs b/assets/javascripts/discourse/components/solved-accept-answer-button.gjs index c205e4c..7a107be 100644 --- a/assets/javascripts/discourse/components/solved-accept-answer-button.gjs +++ b/assets/javascripts/discourse/components/solved-accept-answer-button.gjs @@ -21,12 +21,12 @@ export default class SolvedAcceptAnswerButton extends Component { } @action - acceptAnswer() { + async acceptAnswer() { const post = this.args.post; this.saving = true; try { - acceptPost(post, this.currentUser); + await acceptPost(post, this.currentUser); } finally { this.saving = false; } diff --git a/assets/javascripts/discourse/components/solved-accepted-answer.gjs b/assets/javascripts/discourse/components/solved-accepted-answer.gjs index 73edaa6..4903b1c 100644 --- a/assets/javascripts/discourse/components/solved-accepted-answer.gjs +++ b/assets/javascripts/discourse/components/solved-accepted-answer.gjs @@ -2,6 +2,7 @@ import Component from "@glimmer/component"; import { service } from "@ember/service"; import { htmlSafe } from "@ember/template"; import PostQuotedContent from "discourse/components/post/quoted-content"; +import concatClass from "discourse/helpers/concat-class"; import { iconHTML } from "discourse/lib/icon-library"; import { formatUsername } from "discourse/lib/utilities"; import { i18n } from "discourse-i18n"; @@ -84,26 +85,31 @@ export default class SolvedAcceptedAnswer extends Component { } } diff --git a/assets/javascripts/discourse/initializers/extend-for-solved-button.gjs b/assets/javascripts/discourse/initializers/extend-for-solved-button.gjs index c94c2c6..840a624 100644 --- a/assets/javascripts/discourse/initializers/extend-for-solved-button.gjs +++ b/assets/javascripts/discourse/initializers/extend-for-solved-button.gjs @@ -63,7 +63,9 @@ function customizePost(api) { "post-content-cooked-html", class extends Component { static shouldRender(args) { - return args.post.post_number === 1 && args.post.topic.accepted_answer; + return ( + args.post?.post_number === 1 && args.post?.topic?.accepted_answer + ); }