diff --git a/assets/javascripts/discourse/components/solved-accept-answer-button.gjs b/assets/javascripts/discourse/components/solved-accept-answer-button.gjs index aa885ba..6141336 100644 --- a/assets/javascripts/discourse/components/solved-accept-answer-button.gjs +++ b/assets/javascripts/discourse/components/solved-accept-answer-button.gjs @@ -19,7 +19,7 @@ export default class SolvedAcceptAnswerButton extends Component { @action acceptAnswer() { - acceptAnswer(this.args.post, this.appEvents); + acceptAnswer(this.args.post, this.appEvents, this.currentUser); } } -export function acceptAnswer(post, appEvents) { +export function acceptAnswer(post, appEvents, acceptingUser) { // TODO (glimmer-post-menu): Remove this exported function and move the code into the button action after the widget code is removed - acceptPost(post); + acceptPost(post, acceptingUser); appEvents.trigger("discourse-solved:solution-toggled", post); @@ -46,7 +46,7 @@ export function acceptAnswer(post, appEvents) { }); } -function acceptPost(post) { +function acceptPost(post, acceptingUser) { const topic = post.topic; clearAccepted(topic); @@ -62,6 +62,8 @@ function acceptPost(post) { name: post.name, post_number: post.post_number, excerpt: post.cooked, + accepter_username: acceptingUser.username, + accepter_name: acceptingUser.name, }); ajax("/solution/accept", { diff --git a/assets/javascripts/discourse/initializers/extend-for-solved-button.js b/assets/javascripts/discourse/initializers/extend-for-solved-button.js index 3130262..bb5eead 100644 --- a/assets/javascripts/discourse/initializers/extend-for-solved-button.js +++ b/assets/javascripts/discourse/initializers/extend-for-solved-button.js @@ -36,30 +36,24 @@ function initializeWithApi(api) { const topic = postModel.topic; if (topic.accepted_answer) { const hasExcerpt = !!topic.accepted_answer.excerpt; - - const withExcerpt = ` -