discourse/spec/serializers/topic_tracking_state_item_serializer_spec.rb
Alan Guo Xiang Tan 832b3b9e60
FEATURE: Remove support for legacy navigation menu (#23752)
Why this change?

Back in May 17 2023 along with the release of Discourse 3.1, we announced
on meta that the legacy hamburger dropdown navigation menu is
deprecated and will be dropped in Discourse 3.2. This is the link to the announcement
on meta: https://meta.discourse.org/t/removing-the-legacy-hamburger-navigation-menu-option/265274

## What does this change do?

This change removes the `legacy` option from the `navigation_menu` site
setting and migrates existing sites on the `legacy` option to the
`header dropdown` option.

All references to the `legacy` option in code and tests have been
removed as well.
2023-10-09 07:24:10 +08:00

37 lines
1.3 KiB
Ruby

# frozen_string_literal: true
RSpec.describe TopicTrackingStateItemSerializer do
fab!(:user) { Fabricate(:user) }
fab!(:post) { create_post }
it "serializes topic tracking state reports" do
report = TopicTrackingState.report(user)
serialized = described_class.new(report[0], scope: Guardian.new(user), root: false).as_json
expect(serialized[:topic_id]).to eq(post.topic_id)
expect(serialized[:highest_post_number]).to eq(post.topic.highest_post_number)
expect(serialized[:last_read_post_number]).to eq(nil)
expect(serialized[:created_at]).to be_present
expect(serialized[:notification_level]).to eq(nil)
expect(serialized[:created_in_new_period]).to eq(true)
expect(serialized[:treat_as_new_topic_start_date]).to be_present
end
it "includes tags attribute when `tagging_enabled` site setting is `true`" do
SiteSetting.tagging_enabled = true
post.topic.notifier.watch_topic!(post.topic.user_id)
DiscourseTagging.tag_topic_by_names(
post.topic,
Guardian.new(Discourse.system_user),
%w[bananas apples],
)
report = TopicTrackingState.report(user)
serialized = described_class.new(report[0], scope: Guardian.new(user), root: false).as_json
expect(serialized[:tags]).to contain_exactly("bananas", "apples")
end
end