Skip to content

A platform for community discussion. Free, open, simple.

FIX: Plugin-supplied post admin tooltip is never rendered (#39939)

discourse-patch-triage[bot]07908aa7bb45
diff --git a/frontend/discourse/app/components/admin-post-menu.gjs b/frontend/discourse/app/components/admin-post-menu.gjs
index 388a9721d31..5f84bc2549b 100644
--- a/frontend/discourse/app/components/admin-post-menu.gjs
+++ b/frontend/discourse/app/components/admin-post-menu.gjs
@@ -272,6 +272,8 @@ export default class AdminPostMenu extends Component {
<DButton
@label={{button.label}}
@translatedLabel={{button.translatedLabel}}
+ @title={{button.title}}
+ @translatedTitle={{button.translatedTitle}}
@icon={{button.icon}}
class={{dConcatClass "btn btn-transparent" button.className}}
@action={{fn this.extraAction button}}
diff --git a/frontend/discourse/tests/integration/components/post/post-test.gjs b/frontend/discourse/tests/integration/components/post/post-test.gjs
index dd45555a832..16626e55796 100644
--- a/frontend/discourse/tests/integration/components/post/post-test.gjs
+++ b/frontend/discourse/tests/integration/components/post/post-test.gjs
@@ -486,6 +486,47 @@ module("Integration | Component | Post", function (hooks) {
.doesNotExist("clicking outside clears the popup");
});
+ test("plugin post admin buttons render their tooltips", async function (assert) {
+ this.currentUser.admin = true;
+
+ withPluginApi((api) => {
+ api.addPostAdminMenuButton(() => {
+ return {
+ className: "extra-button-title",
+ icon: "heart",
+ translatedLabel: "Button with title",
+ title: "post.controls.rebake_description",
+ action: () => {},
+ };
+ });
+
+ api.addPostAdminMenuButton(() => {
+ return {
+ className: "extra-button-translated-title",
+ icon: "star",
+ translatedLabel: "Button with translated title",
+ translatedTitle: "A translated tooltip",
+ action: () => {},
+ };
+ });
+ });
+
+ await renderComponent(this.post);
+
+ await click(".post-menu-area .show-post-admin-menu");
+
+ assert
+ .dom(
+ "[data-content][data-identifier='admin-post-menu'] .extra-button-title"
+ )
+ .hasAttribute("title", i18n("post.controls.rebake_description"));
+ assert
+ .dom(
+ "[data-content][data-identifier='admin-post-menu'] .extra-button-translated-title"
+ )
+ .hasAttribute("title", "A translated tooltip");
+ });
+
test("permanently delete topic", async function (assert) {
this.currentUser.admin = true;