From a3cf1cf6ff2c4ee99d8d636ba7c6dbc762066507 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 9 Jun 2020 19:37:06 +0200 Subject: [PATCH] DEV: allows to prepend widgets to post nav controls (#10005) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: RĂ©gis Hanol --- .../javascripts/discourse/app/widgets/post-menu.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/widgets/post-menu.js b/app/assets/javascripts/discourse/app/widgets/post-menu.js index 3798d71cb27..00520eb6622 100644 --- a/app/assets/javascripts/discourse/app/widgets/post-menu.js +++ b/app/assets/javascripts/discourse/app/widgets/post-menu.js @@ -552,8 +552,17 @@ export default createWidget("post-menu", { postControls.push(repliesButton); } - let extraControls = applyDecorators(this, "extra-controls", attrs, state); - postControls.push(h("div.actions", visibleButtons.concat(extraControls))); + const extraControls = applyDecorators(this, "extra-controls", attrs, state); + const beforeExtraControls = applyDecorators( + this, + "before-extra-controls", + attrs, + state + ); + + const controlsButtons = [...beforeExtraControls, ...visibleButtons, ...extraControls]; + + postControls.push(h("div.actions", controlsButtons)); if (state.adminVisible) { postControls.push(this.attach("post-admin-menu", attrs)); }