From b56c86e88f2b9d3dbd8e33429fba7a89444742ef Mon Sep 17 00:00:00 2001 From: Mark VanLandingham Date: Thu, 19 Mar 2026 14:42:43 -0500 Subject: [PATCH] FIX: Remove 'N replies' button from OP --- .../discourse/api-initializers/nested-post-menu-button.js | 5 +++++ spec/system/nested_view_spec.rb | 6 ++++++ spec/system/page_objects/pages/nested_view.rb | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/assets/javascripts/discourse/api-initializers/nested-post-menu-button.js b/assets/javascripts/discourse/api-initializers/nested-post-menu-button.js index 7a91f21..9b69379 100644 --- a/assets/javascripts/discourse/api-initializers/nested-post-menu-button.js +++ b/assets/javascripts/discourse/api-initializers/nested-post-menu-button.js @@ -9,6 +9,11 @@ export default apiInitializer((api) => { return; } + const router = api.container.lookup("service:router"); + if (router.currentRouteName?.startsWith("nested")) { + dag.delete("replies"); + } + dag.add("nested-replies-expand", NestedRepliesExpandButton); }); diff --git a/spec/system/nested_view_spec.rb b/spec/system/nested_view_spec.rb index c7374bd..3b42806 100644 --- a/spec/system/nested_view_spec.rb +++ b/spec/system/nested_view_spec.rb @@ -26,6 +26,12 @@ expect(nested_view).to have_root_post(root_reply) end + it "does not show the standard replies button on the OP" do + nested_view.visit_nested(topic) + + expect(nested_view).to have_no_show_replies_button_for(op) + end + it "shows the original post content" do op.update!(raw: "This is the original post content") op.rebake! diff --git a/spec/system/page_objects/pages/nested_view.rb b/spec/system/page_objects/pages/nested_view.rb index 3c4f4ff..90b4385 100644 --- a/spec/system/page_objects/pages/nested_view.rb +++ b/spec/system/page_objects/pages/nested_view.rb @@ -107,6 +107,10 @@ def has_no_replies_toggle_for?(post) ) end + def has_no_show_replies_button_for?(post) + has_no_css?("[data-post-number='#{post.post_number}'] .post-action-menu__show-replies") + end + def has_depth_line_for?(post) wrapper = nested_post_wrapper(post) wrapper.find(".nested-post__gutter", match: :first).has_css?(".nested-post__depth-line")