Skip to content

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

FEATURE: Sticky sort header for nested replies (#40307)

Mark VanLandingham67f41e99c594
diff --git a/app/assets/stylesheets/common/components/topic-map.scss b/app/assets/stylesheets/common/components/topic-map.scss
index 6c284eb5e52..d6971dbfce8 100644
--- a/app/assets/stylesheets/common/components/topic-map.scss
+++ b/app/assets/stylesheets/common/components/topic-map.scss
@@ -115,7 +115,8 @@ body:not(.archetype-private_message) {
}
}
- .fk-d-menu__trigger {
+ .fk-d-menu__trigger,
+ .topic-map__stat {
display: flex;
flex-direction: column;
justify-content: center;
diff --git a/app/assets/stylesheets/common/nested-view.scss b/app/assets/stylesheets/common/nested-view.scss
index 3d1ce073b28..515319ff6b9 100644
--- a/app/assets/stylesheets/common/nested-view.scss
+++ b/app/assets/stylesheets/common/nested-view.scss
@@ -93,7 +93,9 @@
}
&__topic-map {
- margin-bottom: 1em;
+ margin-bottom: 0.25em;
+ padding-bottom: 0.25em;
+ border-bottom: 0;
max-width: none;
.top-replies {
@@ -109,6 +111,22 @@
margin-bottom: 1em;
}
+ &:not(.nested-context-view) > &__controls {
+ position: sticky;
+ top: var(--header-offset, 0);
+ z-index: z("header") - 3;
+ padding: 0.25em 0;
+ background: var(--secondary);
+ border-bottom: 1px solid var(--primary-low);
+ }
+
+ &__controls-left {
+ display: flex;
+ align-items: center;
+ gap: 0.85em;
+ min-width: 0;
+ }
+
&__controls-right {
display: flex;
align-items: center;
@@ -116,12 +134,33 @@
margin-left: auto;
}
- &__activity-link,
- &__flat-link {
+ &__activity-link {
font-size: var(--font-down-1);
white-space: nowrap;
}
+ .nested-sort-selector {
+ display: flex;
+ align-items: center;
+ gap: 0.35em;
+ margin: 0;
+ font-size: var(--font-down-1);
+
+ &__label {
+ color: var(--primary-high);
+ }
+
+ &__trigger.btn {
+ padding: 0.35em 0.55em;
+ min-height: auto;
+ line-height: var(--line-height-small);
+ }
+
+ .d-icon {
+ margin-left: 0.15em;
+ }
+ }
+
&__op {
margin-bottom: 1.5em;
padding: 1em;
@@ -824,13 +863,6 @@
}
}
-// ── Topic connector link ───────────────────────────────────────────
-.nested-view-link {
- font-size: var(--font-down-1);
- display: block;
- margin-top: 0.5em;
-}
-
// ── Deep-link highlight animation ──────────────────────────────────
.nested-post--highlighted {
animation: nested-post-highlight 2s ease-out;
@@ -932,6 +964,10 @@
margin-bottom: 0;
}
+ .nested-view__controls-left {
+ flex-wrap: wrap;
+ }
+
.nested-context-view__banner {
margin-left: -0.5em;
margin-right: -0.5em;
@@ -1092,10 +1128,6 @@
bottom: 1em;
}
- .nested-sort-selector {
- flex-wrap: wrap;
- }
-
// Strip L-hook connectors on load-more buttons
.nested-post-children__load-more::before {
content: none;
diff --git a/app/serializers/current_user_serializer.rb b/app/serializers/current_user_serializer.rb
index d4c5877ee67..57f33707033 100644
--- a/app/serializers/current_user_serializer.rb
+++ b/app/serializers/current_user_serializer.rb
@@ -27,7 +27,6 @@ class CurrentUserSerializer < BasicUserSerializer
:no_password,
:can_delete_account,
:can_post_anonymously,
- :can_toggle_nested_mode,
:can_ignore_users,
:can_edit_tags,
:can_delete_all_posts_and_topics,
@@ -204,14 +203,6 @@ class CurrentUserSerializer < BasicUserSerializer
(is_anonymous || object.in_any_groups?(SiteSetting.anonymous_posting_allowed_groups_map))
end
- def can_toggle_nested_mode
- object.in_any_groups?(SiteSetting.nested_replies_toggle_mode_groups_map)
- end
-
- def include_can_toggle_nested_mode?
- SiteSetting.nested_replies_enabled
- end
-
def can_ignore_users
scope.can_ignore_users?
end
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index e775630e72a..7636b898990 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -3990,8 +3990,6 @@ en:
nested_replies:
nested_view: "Nested view"
flat_view: "Flat view"
- view_as_nested: "View as nested"
- view_as_flat: "View as flat"
sort:
label: "Sort by"
top: "Top"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 9ee46eea4a2..d730c669c22 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2870,7 +2870,6 @@ en:
nested_replies_default: "Use nested replies as the default view for all topics."
nested_replies_default_sort: "Default sort algorithm for nested replies view."
nested_replies_max_depth: "Maximum visual nesting depth for threaded replies. Posts deeper than this show a 'Continue this thread' link."
- nested_replies_toggle_mode_groups: "Groups that can toggle between nested and flat view."
nested_replies_backfill_batch_size: "Number of topics to backfill nested reply stats for per scheduled run."
nested_replies_cap_nesting_depth: "Cap reply nesting at the maximum visual depth. When enabled, replies to the deepest level are re-parented as siblings instead of children."
fake_upcoming_change: "This is a fake upcoming change for testing purposes. No need to translate this string."
diff --git a/config/site_settings.yml b/config/site_settings.yml
index 71b6a989b1d..2761f03a44a 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -1895,17 +1895,6 @@ nested_replies:
min: 1
max: 10000
hidden: true
- nested_replies_toggle_mode_groups:
- type: group_list
- list_type: compact
- default: "3"
- allow_any: false
- refresh: true
- disallowed_groups: "4"
- area: "posts_and_topics"
- depends_on:
- - "nested_replies_enabled"
- depends_behavior: "hidden"
email:
email_time_window_mins:
diff --git a/frontend/discourse/app/components/nested.gjs b/frontend/discourse/app/components/nested.gjs
index 77d5cd8986d..87080c16598 100644
--- a/frontend/discourse/app/components/nested.gjs
+++ b/frontend/discourse/app/components/nested.gjs
@@ -10,7 +10,6 @@ import PluginOutlet from "discourse/components/plugin-outlet";
import PostAvatar from "discourse/components/post/avatar";
import TopicMap from "discourse/components/topic-map";
import lazyHash from "discourse/helpers/lazy-hash";
-import getURL from "discourse/lib/get-url";
import PostStreamViewportTracker from "discourse/modifiers/post-stream-viewport-tracker";
import { and, gt, includes, not } from "discourse/truth-helpers";
import DButton from "discourse/ui-kit/d-button";
@@ -33,7 +32,6 @@ const postExcerpt = helper(([post]) => {
export default class Nested extends Component {
@service appEvents;
- @service currentUser;
@service header;
@service screenTrack;
@service site;
@@ -80,10 +78,6 @@ export default class Nested extends Component {
}
}
- get flatViewUrl() {
- return getURL(`/t/${this.args.topic.slug}/${this.args.topic.id}?flat=1`);
- }
-
get emptyPath() {
return [];
}
@@ -319,7 +313,10 @@ export default class Nested extends Component {
</div>
<div class="nested-view__controls">
- <NestedSortSelector @current={{@sort}} @onChange={{@changeSort}} />
+ <div class="nested-view__controls-left">
+ <NestedSortSelector @current={{@sort}} @onChange={{@changeSort}} />
+ </div>
+
<div class="nested-view__controls-right">
{{#if @topic.has_activity_log}}
<DButton
@@ -328,13 +325,6 @@ export default class Nested extends Component {
@label="nested_replies.activity_log.link"
/>
{{/if}}
- {{#if this.currentUser.can_toggle_nested_mode}}
- <DButton
- class="btn-flat nested-view__flat-link"
- @href={{this.flatViewUrl}}
- @label="nested_replies.view_as_flat"
- />
- {{/if}}
</div>
</div>
diff --git a/frontend/discourse/app/components/nested/context-view.gjs b/frontend/discourse/app/components/nested/context-view.gjs
index d4309eb53a1..930a2ee6ebd 100644
--- a/frontend/discourse/app/components/nested/context-view.gjs
+++ b/frontend/discourse/app/components/nested/context-view.gjs
@@ -9,7 +9,6 @@ import { service } from "@ember/service";
import MoreTopics from "discourse/components/more-topics";
import PluginOutlet from "discourse/components/plugin-outlet";
import lazyHash from "discourse/helpers/lazy-hash";
-import getURL from "discourse/lib/get-url";
import PostStreamViewportTracker from "discourse/modifiers/post-stream-viewport-tracker";
import { or } from "discourse/truth-helpers";
import DButton from "discourse/ui-kit/d-button";
@@ -23,7 +22,6 @@ import NestedSortSelector from "./sort-selector";
export default class NestedContextView extends Component {
@service appEvents;
- @service currentUser;
@service header;
@service screenTrack;
@@ -91,10 +89,6 @@ export default class NestedContextView extends Component {
return `${this.args.targetPostNumber}:${this.args.contextChain?.post?.id}`;
}
- get flatViewUrl() {
- return getURL(`/t/${this.args.topic.slug}/${this.args.topic.id}?flat=1`);
- }
-
#scrollToTarget() {
if (this.#destroyed) {
return;
@@ -200,7 +194,10 @@ export default class NestedContextView extends Component {
/>
<div class="nested-view__controls">
- <NestedSortSelector @current={{@sort}} @onChange={{@changeSort}} />
+ <div class="nested-view__controls-left">
+ <NestedSortSelector @current={{@sort}} @onChange={{@changeSort}} />
+ </div>
+
<div class="nested-view__controls-right">
{{#if @topic.has_activity_log}}
<DButton
@@ -209,13 +206,6 @@ export default class NestedContextView extends Component {
@label="nested_replies.activity_log.link"
/>
{{/if}}
- {{#if this.currentUser.can_toggle_nested_mode}}
- <DButton
- class="btn-flat nested-view__flat-link"
- @href={{this.flatViewUrl}}
- @label="nested_replies.view_as_flat"
- />
- {{/if}}
</div>
</div>
diff --git a/frontend/discourse/app/components/nested/sort-selector.gjs b/frontend/discourse/app/components/nested/sort-selector.gjs
index c5bdccb59c6..87a5e04928f 100644
--- a/frontend/discourse/app/components/nested/sort-selector.gjs
+++ b/frontend/discourse/app/components/nested/sort-selector.gjs
@@ -1,43 +1,71 @@
+import Component from "@glimmer/component";
import { fn } from "@ember/helper";
-import { on } from "@ember/modifier";
+import { action } from "@ember/object";
+import DMenu from "discourse/float-kit/components/d-menu";
import { eq } from "discourse/truth-helpers";
+import DButton from "discourse/ui-kit/d-button";
+import DDropdownMenu from "discourse/ui-kit/d-dropdown-menu";
+import dIcon from "discourse/ui-kit/helpers/d-icon";
import { i18n } from "discourse-i18n";
-const SortOption = <template>
- <li>
- <button
- type="button"
- class={{if (eq @current @value) "active"}}
- aria-pressed={{if (eq @current @value) "true" "false"}}
- {{on "click" (fn @onChange @value)}}
- >{{@label}}</button>
- </li>
-</template>;
-
-const NestedSortSelector = <template>
- <ul
- class="nested-sort-selector nav-pills"
- aria-label={{i18n "nested_replies.sort.label"}}
- >
- <SortOption
- @value="top"
- @label={{i18n "nested_replies.sort.top"}}
- @current={{@current}}
- @onChange={{@onChange}}
- />
- <SortOption
- @value="new"
- @label={{i18n "nested_replies.sort.new"}}
- @current={{@current}}
- @onChange={{@onChange}}
- />
- <SortOption
- @value="old"
- @label={{i18n "nested_replies.sort.old"}}
- @current={{@current}}
- @onChange={{@onChange}}
- />
- </ul>
-</template>;
-
-export default NestedSortSelector;
+const SORT_OPTIONS = [
+ { value: "top", labelKey: "nested_replies.sort.top" },
+ { value: "new", labelKey: "nested_replies.sort.new" },
+ { value: "old", labelKey: "nested_replies.sort.old" },
+];
+
+export default class NestedSortSelector extends Component {
+ sortOptions = SORT_OPTIONS;
+
+ get currentSortLabel() {
+ const current = this.sortOptions.find(
+ (option) => option.value === this.args.current
+ );
+ return i18n(current?.labelKey || "nested_replies.sort.top");
+ }
+
+ @action
+ onRegisterApi(api) {
+ this.menuApi = api;
+ }
+
+ @action
+ changeSort(sort) {
+ this.args.onChange(sort);
+ this.menuApi.close();
+ }
+
+ <template>
+ <div class="nested-sort-selector">
+ <span class="nested-sort-selector__label">
+ {{i18n "nested_replies.sort.label"}}:
+ </span>
+
+ <DMenu
+ @identifier="nested-sort-selector"
+ @onRegisterApi={{this.onRegisterApi}}
+ @placement="bottom-start"
+ @triggerClass="btn-flat nested-sort-selector__trigger"
+ >
+ <:trigger>
+ <span class="d-button-label">{{this.currentSortLabel}}</span>
+ {{dIcon "angle-down"}}
+ </:trigger>
+
+ <:content>
+ <DDropdownMenu as |dropdown|>
+ {{#each this.sortOptions as |option|}}
+ <dropdown.item>
+ <DButton
+ class={{if (eq @current option.value) "is-selected"}}
+ @translatedLabel={{i18n option.labelKey}}
+ @action={{fn this.changeSort option.value}}
+ />
+ </dropdown.item>
+ {{/each}}
+ </DDropdownMenu>
+ </:content>
+ </DMenu>
+ </div>
+ </template>
+}
diff --git a/frontend/discourse/app/components/topic-map/topic-map-summary.gjs b/frontend/discourse/app/components/topic-map/topic-map-summary.gjs
index c06413ffb4f..eaec4c59e45 100644
--- a/frontend/discourse/app/components/topic-map/topic-map-summary.gjs
+++ b/frontend/discourse/app/components/topic-map/topic-map-summary.gjs
@@ -71,6 +71,14 @@ export default class TopicMapSummary extends Component {
return this.args.postStream?.summary;
}
+ get shouldShowReplyCount() {
+ return this.args.topic.is_nested_view;
+ }
+
+ get replyCount() {
+ return this.args.topic.replyCount;
+ }
+
get topRepliesTitle() {
if (this.topRepliesSummaryEnabled) {
return;
@@ -274,6 +282,15 @@ export default class TopicMapSummary extends Component {
</:content>
</DMenu>
+ {{#if this.shouldShowReplyCount}}
+ <div class="topic-map__stat topic-map__replies">
+ {{dNumber this.replyCount noTitle="true"}}
+ <span class="topic-map__stat-label">
+ {{i18n "replies_lowercase" count=this.replyCount}}
+ </span>
+ </div>
+ {{/if}}
+
{{#if this.hasLikes}}
<DMenu
@arrow={{true}}
diff --git a/frontend/discourse/app/connectors/topic-navigation/nested-view-link.gjs b/frontend/discourse/app/connectors/topic-navigation/nested-view-link.gjs
deleted file mode 100644
index 77376ebf2ba..00000000000
--- a/frontend/discourse/app/connectors/topic-navigation/nested-view-link.gjs
+++ /dev/null
@@ -1,24 +0,0 @@
-import Component from "@glimmer/component";
-import getURL from "discourse/lib/get-url";
-import { i18n } from "discourse-i18n";
-
-export default class NestedViewLink extends Component {
- static shouldRender(args, context) {
- return (
- context.siteSettings.nested_replies_enabled &&
- args.topic?.is_nested_view &&
- context.currentUser?.can_toggle_nested_mode
- );
- }
-
- get nestedUrl() {
- const topic = this.args.outletArgs.topic;
- return getURL(`/n/${topic.slug}/${topic.id}`);
- }
-
- <template>
- <a href={{this.nestedUrl}} class="nested-view-link">{{i18n
- "nested_replies.view_as_nested"
- }}</a>
- </template>
-}
diff --git a/frontend/discourse/app/controllers/nested.js b/frontend/discourse/app/controllers/nested.js
index b006330fbd2..fa9e7853df4 100644
--- a/frontend/discourse/app/controllers/nested.js
+++ b/frontend/discourse/app/controllers/nested.js
@@ -2,11 +2,13 @@ import { tracked } from "@glimmer/tracking";
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { getOwner } from "@ember/owner";
+import { schedule } from "@ember/runloop";
import { service } from "@ember/service";
import NestedActivityLog from "discourse/components/modal/nested-activity-log";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { bind } from "discourse/lib/decorators";
+import { headerOffset } from "discourse/lib/offset-calculator";
import QuoteState from "discourse/lib/quote-state";
import Composer from "discourse/models/composer";
import { i18n } from "discourse-i18n";
@@ -129,7 +131,37 @@ export default class NestedController extends Controller {
@action
changeSort(newSort) {
- this.router.transitionTo({ queryParams: { sort: newSort } });
+ if (newSort === this.sort) {
+ return;
+ }
+
+ const shouldScrollToRoots = !this.contextMode;
+
+ this.router.transitionTo({ queryParams: { sort: newSort } }).then(() => {
+ if (shouldScrollToRoots) {
+ schedule("afterRender", this, this.#scrollToRoots);
+ }
+ });
+ }
+
+ #scrollToRoots() {
+ const roots = document.querySelector(
+ ".nested-view:not(.nested-context-view) > .nested-view__roots"
+ );
+
+ if (!roots) {
+ return;
+ }
+
+ const controls = document.querySelector(
+ ".nested-view:not(.nested-context-view) > .nested-view__controls"
+ );
+ const controlsHeight = controls?.offsetHeight || 0;
+ const rect = roots.getBoundingClientRect();
+
+ window.scrollTo({
+ top: window.scrollY + rect.top - headerOffset() - controlsHeight,
+ });
}
@action
diff --git a/spec/serializers/current_user_serializer_spec.rb b/spec/serializers/current_user_serializer_spec.rb
index 717fc8f96d9..d3cf4f06259 100644
--- a/spec/serializers/current_user_serializer_spec.rb
+++ b/spec/serializers/current_user_serializer_spec.rb
@@ -460,30 +460,6 @@ RSpec.describe CurrentUserSerializer do
end
end
- describe "#can_toggle_nested_mode" do
- it "is not included when nested replies is disabled" do
- SiteSetting.nested_replies_enabled = false
- expect(serializer.as_json).not_to have_key(:can_toggle_nested_mode)
- end
-
- context "when nested replies is enabled" do
- before { SiteSetting.nested_replies_enabled = true }
-
- it "is true when user is in an allowed group" do
- SiteSetting.nested_replies_toggle_mode_groups = Group::AUTO_GROUPS[:staff].to_s
- user.update!(admin: true)
- Group.refresh_automatic_groups!
- user.reload
- expect(serializer.as_json[:can_toggle_nested_mode]).to eq(true)
- end
-
- it "is false when user is not in an allowed group" do
- SiteSetting.nested_replies_toggle_mode_groups = Group::AUTO_GROUPS[:staff].to_s
- expect(serializer.as_json[:can_toggle_nested_mode]).to eq(false)
- end
- end
- end
-
describe "#has_new_upcoming_changes" do
def serialize_for(user)
described_class.new(user, scope: user.guardian, root: false).as_json
diff --git a/spec/system/nested_view_spec.rb b/spec/system/nested_view_spec.rb
index c8af630cd65..eed57f69b84 100644
--- a/spec/system/nested_view_spec.rb
+++ b/spec/system/nested_view_spec.rb
@@ -266,29 +266,6 @@ RSpec.describe "Nested view" do
end
end
- describe "flat view toggle" do
- fab!(:root_reply) { Fabricate(:post, topic: topic, user: Fabricate(:user), raw: "A reply") }
- fab!(:admin)
-
- it "shows the link and navigates to flat view for allowed groups" do
- sign_in(admin)
- nested_view.visit_nested(topic)
-
- expect(nested_view).to have_flat_view_link
- nested_view.click_flat_view_link
-
- expect(page).to have_current_path(%r{/t/#{topic.slug}/#{topic.id}})
- expect(page).to have_current_path(/flat=1/)
- expect(nested_view).to have_no_nested_view
- end
-
- it "does not show the link for users outside allowed groups" do
- nested_view.visit_nested(topic)
-
- expect(nested_view).to have_no_flat_view_link
- end
- end
-
describe "routing" do
fab!(:root_reply) { Fabricate(:post, topic: topic, user: Fabricate(:user), raw: "A reply") }
diff --git a/spec/system/page_objects/pages/nested_view.rb b/spec/system/page_objects/pages/nested_view.rb
index c80976ebd43..0b4004f3387 100644
--- a/spec/system/page_objects/pages/nested_view.rb
+++ b/spec/system/page_objects/pages/nested_view.rb
@@ -189,27 +189,8 @@ module PageObjects
has_no_css?(wrapper_selector(post, ".nested-post__article"))
end
- def has_flat_view_link?
- has_css?(".nested-view__flat-link")
- end
-
- def has_no_flat_view_link?
- has_no_css?(".nested-view__flat-link")
- end
-
- def has_view_as_nested_link?
- has_css?(".nested-view-link")
- end
-
- def has_no_view_as_nested_link?
- has_no_css?(".nested-view-link")
- end
-
def has_sort_active?(sort)
- has_css?(
- ".nested-sort-selector button.active",
- text: I18n.t("js.nested_replies.sort.#{sort}"),
- )
+ has_css?(".nested-sort-selector__trigger", text: I18n.t("js.nested_replies.sort.#{sort}"))
end
def has_op_post?
@@ -403,13 +384,9 @@ module PageObjects
self
end
- def click_flat_view_link
- find(".nested-view__flat-link").click
- self
- end
-
def click_sort(sort)
- find(".nested-sort-selector button", text: I18n.t("js.nested_replies.sort.#{sort}")).click
+ find(".nested-sort-selector__trigger").click
+ find(".dropdown-menu .btn", text: I18n.t("js.nested_replies.sort.#{sort}")).click
self
end
diff --git a/spec/system/view_as_nested_button_spec.rb b/spec/system/view_as_nested_button_spec.rb
deleted file mode 100644
index dbbc02c8a06..00000000000
--- a/spec/system/view_as_nested_button_spec.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe "View as nested button" do
- fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }
- fab!(:admin)
- fab!(:category)
- fab!(:nested_category) { Fabricate(:category, name: "Nested Category") }
- fab!(:topic) { Fabricate(:topic, user: user, category: category) }
- fab!(:op) { Fabricate(:post, topic: topic, user: user, post_number: 1) }
- fab!(:reply) { Fabricate(:post, topic: topic, user: Fabricate(:user), raw: "A reply") }
- fab!(:nested_topic) { Fabricate(:topic, user: user, category: nested_category) }
- fab!(:nested_op) { Fabricate(:post, topic: nested_topic, user: user, post_number: 1) }
- fab!(:nested_reply) do
- Fabricate(:post, topic: nested_topic, user: Fabricate(:user), raw: "A nested reply")
- end
-
- let(:nested_view) { PageObjects::Pages::NestedView.new }
-
- before do
- SiteSetting.nested_replies_enabled = true
- nested_category.category_setting.update!(nested_replies_default: true)
- Fabricate(:nested_topic, topic: nested_topic)
- end
-
- it "does not show the link on a normal topic" do
- sign_in(admin)
- page.visit("/t/#{topic.slug}/#{topic.id}")
-
- expect(nested_view).to have_no_view_as_nested_link
- end
-
- it "shows the link on a nested topic for users in the allowed group" do
- sign_in(admin)
- page.visit("/t/#{nested_topic.slug}/#{nested_topic.id}?flat=1")
-
- expect(nested_view).to have_view_as_nested_link
- end
-
- it "does not show the link for users outside the allowed group" do
- sign_in(user)
- page.visit("/t/#{nested_topic.slug}/#{nested_topic.id}?flat=1")
-
- expect(nested_view).to have_no_view_as_nested_link
- end
-
- it "shows the link when topic has a nested_topic record" do
- sign_in(admin)
- Fabricate(:nested_topic, topic: topic)
-
- page.visit("/t/#{topic.slug}/#{topic.id}?flat=1")
-
- expect(nested_view).to have_view_as_nested_link
- end
-end