Skip to content
This repository was archived by the owner on Apr 21, 2026. It is now read-only.

Commit d9d2121

Browse files
authored
FIX: Remove 'N replies' button from OP (#28)
1 parent 2cd49b5 commit d9d2121

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

assets/javascripts/discourse/api-initializers/nested-post-menu-button.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ export default apiInitializer((api) => {
99
return;
1010
}
1111

12+
const router = api.container.lookup("service:router");
13+
if (router.currentRouteName?.startsWith("nested")) {
14+
dag.delete("replies");
15+
}
16+
1217
dag.add("nested-replies-expand", NestedRepliesExpandButton);
1318
});
1419

spec/system/nested_view_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
expect(nested_view).to have_root_post(root_reply)
2727
end
2828

29+
it "does not show the standard replies button on the OP" do
30+
nested_view.visit_nested(topic)
31+
32+
expect(nested_view).to have_no_show_replies_button_for(op)
33+
end
34+
2935
it "shows the original post content" do
3036
op.update!(raw: "This is the original post content")
3137
op.rebake!

spec/system/page_objects/pages/nested_view.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ def has_no_replies_toggle_for?(post)
107107
)
108108
end
109109

110+
def has_no_show_replies_button_for?(post)
111+
has_no_css?("[data-post-number='#{post.post_number}'] .post-action-menu__show-replies")
112+
end
113+
110114
def has_depth_line_for?(post)
111115
wrapper = nested_post_wrapper(post)
112116
wrapper.find(".nested-post__gutter", match: :first).has_css?(".nested-post__depth-line")

0 commit comments

Comments
 (0)