A platform for community discussion. Free, open, simple.
FEATURE: Add upcoming change for unified new view (#40631)
Martin Brennanc85b12934e7c
diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rbindex 0d52b27af58..965321af53c 100644--- a/app/controllers/topics_controller.rb+++ b/app/controllers/topics_controller.rb@@ -1223,7 +1223,7 @@ class TopicsController < ApplicationControllerdef reset_newtopic_scope =- if current_user.new_new_view_enabled?+ if current_user.unified_new_enabled?if params[:dismiss_topics] && params[:dismiss_posts]TopicQuery.new(current_user).new_and_unread_results(limit: false)elsif params[:dismiss_topics]@@ -1282,7 +1282,7 @@ class TopicsController < ApplicationControllerdismissed_topic_ids = []dismissed_post_topic_ids = []- if !current_user.new_new_view_enabled? || params[:dismiss_topics]+ if !current_user.unified_new_enabled? || params[:dismiss_topics]dismissed_topic_ids =TopicsBulkAction.new(current_user, topic_scope.pluck(:id), type: "dismiss_topics").perform!enddiff --git a/app/models/topic_tracking_state.rb b/app/models/topic_tracking_state.rbindex 507f35e5473..6eb34175b0c 100644--- a/app/models/topic_tracking_state.rb+++ b/app/models/topic_tracking_state.rb@@ -633,7 +633,7 @@ class TopicTrackingStateenddef self.report_totals(user)- if user.new_new_view_enabled?+ if user.unified_new_enabled?{ new: report(user).count }elsenew = report_count_by_type(user, type: "new")diff --git a/app/models/user.rb b/app/models/user.rbindex acb4f84dd1b..9ec9bb84911 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -1983,8 +1983,8 @@ class User < ActiveRecord::Baseuser_status && !user_status.expired?end- def new_new_view_enabled?- in_any_groups?(SiteSetting.experimental_new_new_view_groups_map)+ def unified_new_enabled?+ upcoming_change_enabled?(:enable_unified_new)enddef populated_required_custom_fields?diff --git a/app/serializers/current_user_serializer.rb b/app/serializers/current_user_serializer.rbindex 0d23d2a757b..45f7a93ddac 100644--- a/app/serializers/current_user_serializer.rb+++ b/app/serializers/current_user_serializer.rb@@ -73,7 +73,7 @@ class CurrentUserSerializer < BasicUserSerializer:sidebar_tags,:sidebar_category_ids,:sidebar_sections,- :new_new_view_enabled?,+ :unified_new_enabled?,:can_view_raw_email,:login_method,:has_unseen_features,diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 95754059498..a02f27ef243 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -3945,7 +3945,7 @@ en:education:topic_tracking_preferences: 'You can view and change your new topic tracking settings in <a href="%{basePath}/my/preferences/tracking">your preferences</a>.'unread: "Nothing left unread... impressive!"- new_new: "Nothing new at the moment... check back soon!"+ unified_new: "Nothing new at the moment... check back soon!"new: "Nothing new at the moment... check back soon!"generic: "Nothing to see here...check back soon!"@@ -5402,7 +5402,7 @@ en:new_replies_tooltip: "New replies"replies: "Replies"replies_with_count: "Replies (%{count})"- new_new:+ unified_new:help: "topics created or replied to in the last few days"posted:title: "My posts"diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex 353939e23f7..1789b35eba1 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -2836,7 +2836,7 @@ en:navigation_menu: "Specify sidebar or header dropdown as the main navigation menu for your site. Sidebar is recommended."default_navigation_menu_categories: "Selected categories will be displayed under Navigation Menu's Categories section by default."default_navigation_menu_tags: "Selected tags will be displayed under Navigation Menu's Tags section by default."- experimental_new_new_view_groups: 'Enable a new topics list that combines unread and new topics and make the "Everything" link in the sidebar link to it.'+ enable_unified_new: "Replace the separate New and Unread lists with a single unified New list that makes it easier for members to distinguish between new topics and topics with new replies. When enabled, the /new route shows a combined view with subtabs for Topics (new topics) and Replies (tracked topics with new replies), and the unread option is removed from the top menu."enable_form_templates: "Enable the form templates feature. With it, you can enforce a structured form with data validation as part of the topic creation flow."show_preview_for_form_templates: "Enable the preview for form templates feature"lazy_load_categories_groups: "Lazy load category information only for users of these groups. This improves performance on sites with many categories."@@ -2897,6 +2897,7 @@ en:invalid_integer: "Value must be an integer."regex_mismatch: "Value doesn't match the required format."must_include_latest: "Top menu must include the 'latest' tab."+ top_menu_unread_not_allowed_with_unified_new: "The 'unread' menu item cannot be used when unified new is enabled."invalid_string: "Invalid value."invalid_string_min_max: "Must be between %{min} and %{max} characters."invalid_string_min:diff --git a/config/site_settings.yml b/config/site_settings.ymlindex 1c4f2c939d0..6f8217a51c5 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -286,22 +286,13 @@ basic:type: listlist_type: simpledefault: "latest|new|unread|hot|categories"- regex: "latest"- regex_error: "site_settings.errors.must_include_latest"- validator: RegexPresenceValidator+ validator: "TopMenuValidator"allow_any: false- choices:- - latest- - new- - unread- - unseen- - top- - categories- - read- - posted- - bookmarks- - hot+ choices: "TopMenu.choices"area: "interface"+ upcoming_change_default_override:+ upcoming_change: "enable_unified_new"+ new_default: "latest|new|hot|categories"post_menu:client: truetype: list@@ -4447,14 +4438,15 @@ experimental:default: 15hidden: truearea: "experimental"- experimental_new_new_view_groups:+ enable_unified_new:+ default: false+ hidden: trueclient: true- type: group_list- list_type: compact- default: ""- allow_any: falserefresh: true- area: "group_permissions|navigation|experimental"+ upcoming_change:+ status: "alpha"+ impact: "feature,all_members"+ learn_more_url: "https://meta.discourse.org/t/-/404728"enable_rich_text_paste:client: truedefault: truediff --git a/db/post_migrate/20260607161322_move_unified_new_setting_from_groups.rb b/db/post_migrate/20260607161322_move_unified_new_setting_from_groups.rbnew file mode 100644index 00000000000..5646f1e801b--- /dev/null+++ b/db/post_migrate/20260607161322_move_unified_new_setting_from_groups.rb@@ -0,0 +1,35 @@+# frozen_string_literal: true+class MoveUnifiedNewSettingFromGroups < ActiveRecord::Migration[8.0]+ def up+ # For sites with experimental_new_new_view_groups configured,+ # copy those groups to site_setting_groups for enable_unified_new+ # and enable the new setting+ execute(<<~SQL)+ INSERT INTO site_setting_groups (name, group_ids, created_at, updated_at)+ SELECT 'enable_unified_new', value, NOW(), NOW()+ FROM site_settings+ WHERE name = 'experimental_new_new_view_groups'+ AND value IS NOT NULL+ AND value != ''+ ON CONFLICT (name) DO NOTHING+ SQL++ # Enable the setting for sites that had groups configured+ execute(<<~SQL)+ INSERT INTO site_settings (name, data_type, value, created_at, updated_at)+ SELECT 'enable_unified_new', 5, 't', NOW(), NOW()+ FROM site_settings+ WHERE name = 'experimental_new_new_view_groups'+ AND value IS NOT NULL+ AND value != ''+ ON CONFLICT (name) DO NOTHING+ SQL++ # Delete the old experimental setting+ execute("DELETE FROM site_settings WHERE name = 'experimental_new_new_view_groups'")+ end++ def down+ raise ActiveRecord::IrreversibleMigration+ end+enddiff --git a/db/structure.sql b/db/structure.sqlindex 80b64f55555..22823141632 100644--- a/db/structure.sql+++ b/db/structure.sql@@ -21912,6 +21912,7 @@ ALTER TABLE ONLY public.ad_plugin_house_ads_groupsSET search_path TO "$user", public;INSERT INTO "schema_migrations" (version) VALUES+('20260607161322'),('20260604052235'),('20260603115312'),('20260603115200'),diff --git a/frontend/discourse/app/components/d-navigation.gjs b/frontend/discourse/app/components/d-navigation.gjsindex 974580d959b..31e92a3a638 100644--- a/frontend/discourse/app/components/d-navigation.gjs+++ b/frontend/discourse/app/components/d-navigation.gjs@@ -203,12 +203,12 @@ export default class DNavigation extends Component {});}- @computed("showResetNew", "filterType", "currentUser.new_new_view_enabled")+ @computed("showResetNew", "filterType", "currentUser.unified_new_enabled")get showNewDismissCombo() {return (this.showResetNew &&this.filterType === "new" &&- this.currentUser.new_new_view_enabled+ this.currentUser.unified_new_enabled);}diff --git a/frontend/discourse/app/components/discovery/topics.gjs b/frontend/discourse/app/components/discovery/topics.gjsindex f2fb20068f4..dea11a4dc84 100644--- a/frontend/discourse/app/components/discovery/topics.gjs+++ b/frontend/discourse/app/components/discovery/topics.gjs@@ -87,13 +87,13 @@ export default class DiscoveryTopics extends Component {}get showTopicsAndRepliesToggle() {- return this.new && this.currentUser?.new_new_view_enabled;+ return this.new && this.currentUser?.unified_new_enabled;}get newRepliesCount() {this.topicTrackingState.get("messageCount"); // Autotrack this- if (this.currentUser?.new_new_view_enabled) {+ if (this.currentUser?.unified_new_enabled) {return this.topicTrackingState.countUnread({categoryId: this.args.category?.id,noSubcategories: this.args.noSubcategories,@@ -107,7 +107,7 @@ export default class DiscoveryTopics extends Component {get newTopicsCount() {this.topicTrackingState.get("messageCount"); // Autotrack this- if (this.currentUser?.new_new_view_enabled) {+ if (this.currentUser?.unified_new_enabled) {return this.topicTrackingState.countNew({categoryId: this.args.category?.id,noSubcategories: this.args.noSubcategories,@@ -119,7 +119,7 @@ export default class DiscoveryTopics extends Component {}get showTopicPostBadges() {- return !this.new || this.currentUser?.new_new_view_enabled;+ return !this.new || this.currentUser?.unified_new_enabled;}get showEmptyFilterEducationInFooter() {diff --git a/frontend/discourse/app/components/empty-topic-filter.gjs b/frontend/discourse/app/components/empty-topic-filter.gjsindex 81c8f9523a8..049b772fd8a 100644--- a/frontend/discourse/app/components/empty-topic-filter.gjs+++ b/frontend/discourse/app/components/empty-topic-filter.gjs@@ -13,8 +13,8 @@ export default class EmptyTopicFilter extends Component {if (this.args.unreadFilter) {return i18n("topics.none.education.unread");} else if (this.args.newFilter) {- if (this.currentUser.new_new_view_enabled) {- return i18n("topics.none.education.new_new");+ if (this.currentUser.unified_new_enabled) {+ return i18n("topics.none.education.unified_new");} else {return i18n("topics.none.education.new");}@@ -24,7 +24,7 @@ export default class EmptyTopicFilter extends Component {}get ctaLabelWithAction() {- if (this.currentUser.new_new_view_enabled) {+ if (this.currentUser.unified_new_enabled) {if (this.args.newListSubset === "topics") {if (this.args.trackingCounts.newReplies > 0) {return {@@ -53,7 +53,7 @@ export default class EmptyTopicFilter extends Component {get ctaRoute() {if (- this.currentUser.new_new_view_enabled &&+ this.currentUser.unified_new_enabled &&this.ctaLabelWithAction.action) {return;diff --git a/frontend/discourse/app/components/navigation-item.gjs b/frontend/discourse/app/components/navigation-item.gjsindex 3b24d1b0509..b24a3f9c4af 100644--- a/frontend/discourse/app/components/navigation-item.gjs+++ b/frontend/discourse/app/components/navigation-item.gjs@@ -31,7 +31,7 @@ export default class NavigationItem extends Component {return (!this.active &&this.currentUser &&- !this.currentUser.new_new_view_enabled &&+ !this.currentUser.unified_new_enabled &&this.currentUser.trust_level > 0 &&(this.content?.name === "new" || this.content?.name === "unread") &&this.content?.count < 1diff --git a/frontend/discourse/app/components/topic-dismiss-buttons.gjs b/frontend/discourse/app/components/topic-dismiss-buttons.gjsindex 8f3774ecde2..819200cb13a 100644--- a/frontend/discourse/app/components/topic-dismiss-buttons.gjs+++ b/frontend/discourse/app/components/topic-dismiss-buttons.gjs@@ -30,7 +30,7 @@ export default class TopicDismissButtons extends Component {}get dismissNewLabel() {- if (this.currentUser?.new_new_view_enabled) {+ if (this.currentUser?.unified_new_enabled) {switch (this.newListSubset) {case "topics":if (this.args.selectedTopics.length > 0) {diff --git a/frontend/discourse/app/controllers/discovery/list.js b/frontend/discourse/app/controllers/discovery/list.jsindex 2e738f4d767..212cab48a09 100644--- a/frontend/discourse/app/controllers/discovery/list.js+++ b/frontend/discourse/app/controllers/discovery/list.js@@ -195,7 +195,7 @@ export default class DiscoveryListController extends Controller {@actionresetNew(overrides = {}) {- if (!this.currentUser.new_new_view_enabled) {+ if (!this.currentUser.unified_new_enabled) {return this.callResetNew();}diff --git a/frontend/discourse/app/lib/sidebar/common/community-section/everything-section-link.js b/frontend/discourse/app/lib/sidebar/common/community-section/everything-section-link.jsindex d6fd1d4444b..8d6d0ba3d0f 100644--- a/frontend/discourse/app/lib/sidebar/common/community-section/everything-section-link.js+++ b/frontend/discourse/app/lib/sidebar/common/community-section/everything-section-link.js@@ -26,7 +26,7 @@ export default class EverythingSectionLink extends BaseSectionLink {this.totalUnread = this.topicTrackingState.countUnread();- if (this.totalUnread === 0 || this.#newNewViewEnabled) {+ if (this.totalUnread === 0 || this.#unifiedNewEnabled) {this.totalNew = this.topicTrackingState.countNew();}}@@ -63,7 +63,7 @@ export default class EverythingSectionLink extends BaseSectionLink {return;}- if (this.#newNewViewEnabled && this.#unreadAndNewCount > 0) {+ if (this.#unifiedNewEnabled && this.#unreadAndNewCount > 0) {return this.#unreadAndNewCount.toString();} else if (this.totalUnread > 0) {return i18n("sidebar.unread_count", {@@ -78,7 +78,7 @@ export default class EverythingSectionLink extends BaseSectionLink {get route() {if (this.currentUser?.sidebarLinkToFilteredList) {- if (this.#newNewViewEnabled && this.#unreadAndNewCount > 0) {+ if (this.#unifiedNewEnabled && this.#unreadAndNewCount > 0) {return "discovery.new";} else if (this.totalUnread > 0) {return "discovery.unread";@@ -111,7 +111,7 @@ export default class EverythingSectionLink extends BaseSectionLink {return this.totalUnread + this.totalNew;}- get #newNewViewEnabled() {- return !!this.currentUser?.new_new_view_enabled;+ get #unifiedNewEnabled() {+ return !!this.currentUser?.unified_new_enabled;}}diff --git a/frontend/discourse/app/lib/sidebar/user/categories-section/category-section-link.js b/frontend/discourse/app/lib/sidebar/user/categories-section/category-section-link.jsindex 3b74f03da36..1fb98515c5d 100644--- a/frontend/discourse/app/lib/sidebar/user/categories-section/category-section-link.js+++ b/frontend/discourse/app/lib/sidebar/user/categories-section/category-section-link.js@@ -117,7 +117,7 @@ export default class CategorySectionLink {#countables() {const countables = [];- if (this.#newNewViewEnabled) {+ if (this.#unifiedNewEnabled) {countables.push(UNREAD_AND_NEW_COUNTABLE);} else {countables.push(...DEFAULT_COUNTABLES);@@ -284,7 +284,7 @@ export default class CategorySectionLink {}}- get #newNewViewEnabled() {- return !!this.currentUser?.new_new_view_enabled;+ get #unifiedNewEnabled() {+ return !!this.currentUser?.unified_new_enabled;}}diff --git a/frontend/discourse/app/lib/sidebar/user/community-section/my-posts-section-link.js b/frontend/discourse/app/lib/sidebar/user/community-section/my-posts-section-link.jsindex 00962a45dbf..b2ffc9f2c37 100644--- a/frontend/discourse/app/lib/sidebar/user/community-section/my-posts-section-link.js+++ b/frontend/discourse/app/lib/sidebar/user/community-section/my-posts-section-link.js@@ -68,7 +68,7 @@ export default class MyPostsSectionLink extends BaseSectionLink {}get text() {- if (this._hasDraft && this.currentUser?.new_new_view_enabled) {+ if (this._hasDraft && this.currentUser?.unified_new_enabled) {return i18n("sidebar.sections.community.links.my_posts.content_drafts");} else {return i18n(@@ -85,7 +85,7 @@ export default class MyPostsSectionLink extends BaseSectionLink {return;}- if (this.currentUser.new_new_view_enabled) {+ if (this.currentUser.unified_new_enabled) {return this.draftCount.toString();} else {return i18n("sidebar.sections.community.links.my_posts.draft_count", {@@ -99,7 +99,7 @@ export default class MyPostsSectionLink extends BaseSectionLink {}get defaultPrefixValue() {- if (this._hasDraft && this.currentUser?.new_new_view_enabled) {+ if (this._hasDraft && this.currentUser?.unified_new_enabled) {return "pencil";}return "user";diff --git a/frontend/discourse/app/lib/sidebar/user/tags-section/tag-section-link.js b/frontend/discourse/app/lib/sidebar/user/tags-section/tag-section-link.jsindex c377bbb071c..79e9e9b201b 100644--- a/frontend/discourse/app/lib/sidebar/user/tags-section/tag-section-link.js+++ b/frontend/discourse/app/lib/sidebar/user/tags-section/tag-section-link.js@@ -19,7 +19,7 @@ export default class TagSectionLink extends BaseTagSectionLink {tagId: this.tag.id,});- if (this.totalUnread === 0 || this.#newNewViewEnabled) {+ if (this.totalUnread === 0 || this.#unifiedNewEnabled) {this.totalNew = this.topicTrackingState.countNew({tagId: this.tag.id,});@@ -36,7 +36,7 @@ export default class TagSectionLink extends BaseTagSectionLink {get route() {if (this.currentUser?.sidebarLinkToFilteredList) {- if (this.#newNewViewEnabled && this.#unreadAndNewCount > 0) {+ if (this.#unifiedNewEnabled && this.#unreadAndNewCount > 0) {return "tag.showNew";} else if (this.totalUnread > 0) {return "tag.showUnread";@@ -56,7 +56,7 @@ export default class TagSectionLink extends BaseTagSectionLink {return;}- if (this.#newNewViewEnabled && this.#unreadAndNewCount > 0) {+ if (this.#unifiedNewEnabled && this.#unreadAndNewCount > 0) {return this.#unreadAndNewCount.toString();} else if (this.totalUnread > 0) {return i18n("sidebar.unread_count", {@@ -87,7 +87,7 @@ export default class TagSectionLink extends BaseTagSectionLink {return this.totalUnread + this.totalNew;}- get #newNewViewEnabled() {- return !!this.currentUser?.new_new_view_enabled;+ get #unifiedNewEnabled() {+ return !!this.currentUser?.unified_new_enabled;}}diff --git a/frontend/discourse/app/models/nav-item.js b/frontend/discourse/app/models/nav-item.jsindex eb4666c6485..46d5d1a5193 100644--- a/frontend/discourse/app/models/nav-item.js+++ b/frontend/discourse/app/models/nav-item.js@@ -129,7 +129,7 @@ export default class NavItem extends EmberObject {let items = args.siteSettings.top_menu.split("|");const user = getOwnerWithFallback(this).lookup("service:current-user");- if (user?.new_new_view_enabled) {+ if (user?.unified_new_enabled) {items = items.filter((item) => item !== "unread");}const filterType = (args.filterMode || "").split("/").pop();@@ -248,8 +248,8 @@ export default class NavItem extends EmberObject {let nameKey = this.name.replace("/", ".");- if (nameKey === "new" && this.currentUser?.new_new_view_enabled) {- nameKey = "new_new";+ if (nameKey === "new" && this.currentUser?.unified_new_enabled) {+ nameKey = "unified_new";}return i18n("filters." + nameKey + ".help", {});diff --git a/frontend/discourse/app/models/topic-tracking-state.js b/frontend/discourse/app/models/topic-tracking-state.jsindex 8a1d16aaddd..98537325751 100644--- a/frontend/discourse/app/models/topic-tracking-state.js+++ b/frontend/discourse/app/models/topic-tracking-state.js@@ -296,7 +296,7 @@ export default class TopicTrackingState extends EmberObject {}const unreadRecipients = ["all", "unread", "unseen"];- if (this.currentUser?.new_new_view_enabled) {+ if (this.currentUser?.unified_new_enabled) {unreadRecipients.push("new");}// count an unread topic as incoming@@ -705,7 +705,7 @@ export default class TopicTrackingState extends EmberObject {noSubcategories,customFilterFn,});- if (!this.currentUser?.new_new_view_enabled) {+ if (!this.currentUser?.unified_new_enabled) {count += this.lookupCount({type: "unread",category,@@ -726,7 +726,7 @@ export default class TopicTrackingState extends EmberObject {noSubcategories,customFilterFn,});- if (this.currentUser?.new_new_view_enabled) {+ if (this.currentUser?.unified_new_enabled) {count += this.countUnread({categoryId,tagId,@@ -816,7 +816,7 @@ export default class TopicTrackingState extends EmberObject {state &&state.last_read_post_number > 0 &&(topic.last_read_post_number === 0 ||- !this.currentUser?.new_new_view_enabled)+ !this.currentUser?.unified_new_enabled)) {if (filter === "new") {list.topics.splice(index, 1);diff --git a/frontend/discourse/app/ui-kit/d-count-i18n.gjs b/frontend/discourse/app/ui-kit/d-count-i18n.gjsindex e64648185e1..3bd994bc697 100644--- a/frontend/discourse/app/ui-kit/d-count-i18n.gjs+++ b/frontend/discourse/app/ui-kit/d-count-i18n.gjs@@ -13,7 +13,7 @@ export default class DCountI18n extends Component {key += this.args.suffix;}- if (this.currentUser?.new_new_view_enabled && key === "topic_count_new") {+ if (this.currentUser?.unified_new_enabled && key === "topic_count_new") {key = "topic_count_latest";}diff --git a/frontend/discourse/tests/acceptance/mobile-new-dismiss-test.js b/frontend/discourse/tests/acceptance/mobile-new-dismiss-test.jsindex f362edeecff..f2f20ced903 100644--- a/frontend/discourse/tests/acceptance/mobile-new-dismiss-test.js+++ b/frontend/discourse/tests/acceptance/mobile-new-dismiss-test.js@@ -7,7 +7,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";acceptance("New dismiss - Mobile", function (needs) {needs.mobileView();needs.settings({ floating_dismiss_topics_on_mobile: true });- needs.user({ new_new_view_enabled: true });+ needs.user({ unified_new_enabled: true });needs.pretender((server, helper) => {const topicList = cloneJSON(topicFixtures["/latest.json"]);topicList.topic_list.more_topics_url = null;diff --git a/frontend/discourse/tests/acceptance/new-topics-test.js b/frontend/discourse/tests/acceptance/new-topics-test.jsindex 33a072da4bd..ea7a66d7b10 100644--- a/frontend/discourse/tests/acceptance/new-topics-test.js+++ b/frontend/discourse/tests/acceptance/new-topics-test.js@@ -5,7 +5,7 @@ import { i18n } from "discourse-i18n";acceptance("New Topics - New new view enabled", function (needs) {needs.user({- new_new_view_enabled: true,+ unified_new_enabled: true,});needs.pretender((server, helper) => {@@ -20,6 +20,6 @@ acceptance("New Topics - New new view enabled", function (needs) {await visit("/new");assert.dom(".topic-list-bottom .empty-state__title")- .hasText(i18n("topics.none.education.new_new"));+ .hasText(i18n("topics.none.education.unified_new"));});});diff --git a/frontend/discourse/tests/acceptance/sidebar-user-categories-section-test.js b/frontend/discourse/tests/acceptance/sidebar-user-categories-section-test.jsindex 9b3c2a6d3ae..21ebb14c7ea 100644--- a/frontend/discourse/tests/acceptance/sidebar-user-categories-section-test.js+++ b/frontend/discourse/tests/acceptance/sidebar-user-categories-section-test.js@@ -1064,7 +1064,7 @@ acceptance(navigation_menu: "sidebar",});- needs.user({ new_new_view_enabled: true });+ needs.user({ unified_new_enabled: true });test("count shown next to category link when sidebar_show_count_of_new_items is true", async function (assert) {const categories = Site.current().categories;diff --git a/frontend/discourse/tests/acceptance/sidebar-user-community-section-test.js b/frontend/discourse/tests/acceptance/sidebar-user-community-section-test.jsindex 00b74ff173e..d28ec87fb5c 100644--- a/frontend/discourse/tests/acceptance/sidebar-user-community-section-test.js+++ b/frontend/discourse/tests/acceptance/sidebar-user-community-section-test.js@@ -583,7 +583,7 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {user_option: {sidebar_show_count_of_new_items: true,},- new_new_view_enabled: true,+ unified_new_enabled: true,});await visit("/");@@ -1095,7 +1095,7 @@ acceptance("Sidebar - Logged on user - Community Section - New new view experiment enabled",function (needs) {needs.user({- new_new_view_enabled: true,+ unified_new_enabled: true,});needs.settings({diff --git a/frontend/discourse/tests/acceptance/sidebar-user-tags-section-test.js b/frontend/discourse/tests/acceptance/sidebar-user-tags-section-test.jsindex 912b33de1e5..9ef750e5efa 100644--- a/frontend/discourse/tests/acceptance/sidebar-user-tags-section-test.js+++ b/frontend/discourse/tests/acceptance/sidebar-user-tags-section-test.js@@ -578,7 +578,7 @@ acceptance(});needs.user({- new_new_view_enabled: true,+ unified_new_enabled: true,display_sidebar_tags: true,sidebar_tags: [{ id: 2, name: "tag2", slug: "tag2", pm_only: false },diff --git a/frontend/discourse/tests/integration/components/empty-topic-filter-test.gjs b/frontend/discourse/tests/integration/components/empty-topic-filter-test.gjsindex d36b5b230fc..1fae338d84b 100644--- a/frontend/discourse/tests/integration/components/empty-topic-filter-test.gjs+++ b/frontend/discourse/tests/integration/components/empty-topic-filter-test.gjs@@ -8,7 +8,7 @@ module("Integration | Component | EmptyTopicFilter", function (hooks) {setupRenderingTest(hooks);test("renders empty state with CTA when viewing topics with available replies", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.trackingCounts = { newReplies: 5, newTopics: 0 };this.newListSubset = "topics";this.actionCalled = false;@@ -37,7 +37,7 @@ module("Integration | Component | EmptyTopicFilter", function (hooks) {});test("renders empty state with CTA when viewing replies with available topics", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.trackingCounts = { newReplies: 0, newTopics: 5 };this.newListSubset = "replies";this.actionCalled = false;@@ -66,7 +66,7 @@ module("Integration | Component | EmptyTopicFilter", function (hooks) {});test("renders empty state with discovery.latest link when no alternative content available", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.trackingCounts = { newReplies: 0, newTopics: 0 };this.newListSubset = "topics";this.changeNewListSubset = () => {};@@ -88,8 +88,8 @@ module("Integration | Component | EmptyTopicFilter", function (hooks) {.hasText(/latest/i, "CTA links to latest topics");});- test("renders empty state with discovery.latest link when new_new_view is disabled", async function (assert) {- this.currentUser.new_new_view_enabled = false;+ test("renders empty state with discovery.latest link when unified_new_view is disabled", async function (assert) {+ this.currentUser.unified_new_enabled = false;this.trackingCounts = { newReplies: 5, newTopics: 0 };this.newListSubset = "topics";this.changeNewListSubset = () => {};@@ -112,7 +112,7 @@ module("Integration | Component | EmptyTopicFilter", function (hooks) {});test("renders empty state for unread filter", async function (assert) {- this.currentUser.new_new_view_enabled = false;+ this.currentUser.unified_new_enabled = false;await render(<template><EmptyTopicFilter @unreadFilter={{true}} /></template>@@ -134,8 +134,8 @@ module("Integration | Component | EmptyTopicFilter", function (hooks) {.hasText(i18n("topics.none.education.new"));});- test("renders new_new education text when newFilter is true and new_new_view_enabled", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ test("renders unified_new education text when newFilter is true and unified_new_enabled", async function (assert) {+ this.currentUser.unified_new_enabled = true;await render(<template>@@ -145,7 +145,7 @@ module("Integration | Component | EmptyTopicFilter", function (hooks) {assert.dom(".empty-state__title")- .hasText(i18n("topics.none.education.new_new"));+ .hasText(i18n("topics.none.education.unified_new"));});test("renders unread education text when unreadFilter is true", async function (assert) {diff --git a/frontend/discourse/tests/integration/components/empty-topic-filter.gjs b/frontend/discourse/tests/integration/components/empty-topic-filter.gjsindex 06374e76e19..de206a7b4cc 100644--- a/frontend/discourse/tests/integration/components/empty-topic-filter.gjs+++ b/frontend/discourse/tests/integration/components/empty-topic-filter.gjs@@ -20,8 +20,8 @@ module("Integration | Component | EmptyTopicFilter", function (hooks) {.hasText(i18n("topics.none.education.new"));});- test("renders new_new education text when newFilter is true and new_new_view_enabled", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ test("renders unified_new education text when newFilter is true and unified_new_enabled", async function (assert) {+ this.currentUser.unified_new_enabled = true;await render(<template>@@ -31,7 +31,7 @@ module("Integration | Component | EmptyTopicFilter", function (hooks) {assert.dom(".empty-topic-filter__text")- .hasText(i18n("topics.none.education.new_new"));+ .hasText(i18n("topics.none.education.unified_new"));});test("renders unread education text when unreadFilter is true", async function (assert) {diff --git a/frontend/discourse/tests/integration/components/topic-dismiss-buttons-test.gjs b/frontend/discourse/tests/integration/components/topic-dismiss-buttons-test.gjsindex 4cfbe9972d2..6deb972ab05 100644--- a/frontend/discourse/tests/integration/components/topic-dismiss-buttons-test.gjs+++ b/frontend/discourse/tests/integration/components/topic-dismiss-buttons-test.gjs@@ -20,7 +20,7 @@ module("Integration | Component | TopicDismissButtons", function (hooks) {});test("renders a direct dismiss all combo button in the experimental new view", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.showNewDismissCombo = true;await render(@@ -42,7 +42,7 @@ module("Integration | Component | TopicDismissButtons", function (hooks) {});test("dismisses the active subset directly in the experimental new view", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.showNewDismissCombo = true;this.model.params.subset = "replies";@@ -76,7 +76,7 @@ module("Integration | Component | TopicDismissButtons", function (hooks) {});test("dismiss and stop tracking runs the same subset with untrack enabled", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.showNewDismissCombo = true;this.model.params.subset = "replies";@@ -112,7 +112,7 @@ module("Integration | Component | TopicDismissButtons", function (hooks) {});test("does not show stop tracking on the topics subset", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.showNewDismissCombo = true;this.model.params.subset = "topics";@@ -147,7 +147,7 @@ module("Integration | Component | TopicDismissButtons", function (hooks) {});test("does not render the combo menu on mobile bottom dismiss", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.showNewDismissCombo = true;this.model.topics = new Array(6).fill({});@@ -179,7 +179,7 @@ module("Integration | Component | TopicDismissButtons", function (hooks) {});test("shows count of selected topics in the dismiss new topics button", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.showNewDismissCombo = true;this.model.params.subset = "topics";this.selectedTopics = [{ id: 1 }, { id: 2 }];@@ -206,7 +206,7 @@ module("Integration | Component | TopicDismissButtons", function (hooks) {});test("shows count of selected topics in the dismiss new replies button", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.showNewDismissCombo = true;this.model.params.subset = "replies";this.selectedTopics = [{ id: 1 }, { id: 2 }];@@ -233,7 +233,7 @@ module("Integration | Component | TopicDismissButtons", function (hooks) {});test("shows count of selected topics in the dismiss all button", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.showNewDismissCombo = true;this.model.params.subset = "all";this.selectedTopics = [{ id: 1 }, { id: 2 }];diff --git a/frontend/discourse/tests/unit/models/topic-tracking-state-test.js b/frontend/discourse/tests/unit/models/topic-tracking-state-test.jsindex 73329453a92..f6bb27f9351 100644--- a/frontend/discourse/tests/unit/models/topic-tracking-state-test.js+++ b/frontend/discourse/tests/unit/models/topic-tracking-state-test.js@@ -815,7 +815,7 @@ module("Unit | Model | topic-tracking-state | /unread", function (hooks) {});test("adds unread incoming to the new topic list if new new view is enabled", async function (assert) {- this.currentUser.new_new_view_enabled = true;+ this.currentUser.unified_new_enabled = true;this.trackingState.trackIncoming("new");await publishToMessageBus("/unread", unreadTopicPayload);@@ -833,7 +833,7 @@ module("Unit | Model | topic-tracking-state | /unread", function (hooks) {});test("doesn't add unread incoming to the new topic list if new new view is disabled", async function (assert) {- this.currentUser.new_new_view_enabled = false;+ this.currentUser.unified_new_enabled = false;this.trackingState.trackIncoming("new");await publishToMessageBus("/unread", unreadTopicPayload);diff --git a/lib/top_menu.rb b/lib/top_menu.rbnew file mode 100644index 00000000000..96fa6aa30f9--- /dev/null+++ b/lib/top_menu.rb@@ -0,0 +1,15 @@+# frozen_string_literal: true++module TopMenu+ def self.choices+ base = %w[latest new unseen top categories read posted bookmarks hot]+ begin+ base << "unread" unless UpcomingChanges.enabled?(:enable_unified_new)+ rescue ArgumentError+ # During initial settings load, the enable_unified_new setting may not+ # be registered yet. Default to including unread in that case.+ base << "unread"+ end+ base+ end+enddiff --git a/lib/topic_query.rb b/lib/topic_query.rbindex 00034ade4a3..45d647dbf0d 100644--- a/lib/topic_query.rb+++ b/lib/topic_query.rb@@ -259,7 +259,7 @@ class TopicQuerybuilder.add_results(unread_messages(pm_params.merge(count: builder.results_left)))endelse- if @user.new_new_view_enabled?+ if @user.unified_new_enabled?builder.add_results(new_and_unread_results(topic:,@@ -334,7 +334,7 @@ class TopicQueryenddef list_new- if @user&.new_new_view_enabled?+ if @user&.unified_new_enabled?list =case @options[:subset]when "topics"diff --git a/lib/validators/top_menu_validator.rb b/lib/validators/top_menu_validator.rbnew file mode 100644index 00000000000..729739b87b7--- /dev/null+++ b/lib/validators/top_menu_validator.rb@@ -0,0 +1,26 @@+# frozen_string_literal: true++class TopMenuValidator+ def initialize(opts = {})+ @opts = opts+ end++ def valid_value?(val)+ return true if val.blank?+ val_choices = val.split("|").map(&:strip).compact++ return false if !val_choices.all? { |choice| TopMenu.choices.include?(choice) }++ return false if !val_choices.include?("latest")++ val_choices.each do |choice|+ return false if choice == "unread" && UpcomingChanges.enabled?(:enable_unified_new)+ end++ true+ end++ def error_message+ I18n.t("site_settings.errors.top_menu_unread_not_allowed_with_unified_new")+ end+enddiff --git a/public/images/upcoming_changes/enable_unified_new.png b/public/images/upcoming_changes/enable_unified_new.pngnew file mode 100644index 00000000000..0350fddaa53Binary files /dev/null and b/public/images/upcoming_changes/enable_unified_new.png differdiff --git a/spec/lib/site_setting_extension_spec.rb b/spec/lib/site_setting_extension_spec.rbindex eae0348e0d5..b3397eb9612 100644--- a/spec/lib/site_setting_extension_spec.rb+++ b/spec/lib/site_setting_extension_spec.rb@@ -1779,43 +1779,6 @@ RSpec.describe SiteSettingExtension doexpect(SiteSetting.pm_tags_allowed_for_groups_map).to eq([])expect(SiteSetting.exclude_rel_nofollow_domains_map).to eq([])end-- describe "granular_anonymous_and_logged_in_groups_permissions read-time swap" do- let(:everyone_id) { Group::AUTO_GROUPS[:everyone] }- let(:logged_in_id) { Group::AUTO_GROUPS[:logged_in_users] }-- it "returns the stored ids unchanged when the upcoming change is disabled" do- SiteSetting.granular_anonymous_and_logged_in_groups_permissions = false- SiteSetting.experimental_new_new_view_groups = "#{everyone_id}|11"- expect(SiteSetting.experimental_new_new_view_groups_map).to eq([everyone_id, 11])- end-- it "swaps 0 for logged_in_users when the upcoming change is enabled" do- SiteSetting.granular_anonymous_and_logged_in_groups_permissions = true- SiteSetting.experimental_new_new_view_groups = "#{everyone_id}|11"- expect(SiteSetting.experimental_new_new_view_groups_map).to eq([logged_in_id, 11])- end-- it "dedups when logged_in_users is already stored alongside everyone" do- SiteSetting.granular_anonymous_and_logged_in_groups_permissions = true- SiteSetting.experimental_new_new_view_groups = "#{everyone_id}|#{logged_in_id}|1"- expect(SiteSetting.experimental_new_new_view_groups_map).to eq([logged_in_id, 1])- end-- it "leaves the stored database value untouched" do- SiteSetting.experimental_new_new_view_groups = "#{everyone_id}|11"- SiteSetting.granular_anonymous_and_logged_in_groups_permissions = true- SiteSetting.experimental_new_new_view_groups_map # trigger getter-- expect(SiteSetting.experimental_new_new_view_groups).to eq("#{everyone_id}|11")- end-- it "does not affect category_list settings" do- SiteSetting.granular_anonymous_and_logged_in_groups_permissions = true- SiteSetting.digest_suppress_categories = "#{everyone_id}|4"- expect(SiteSetting.digest_suppress_categories_map).to eq([everyone_id, 4])- end- endenddescribe "keywords" dodiff --git a/spec/lib/topic_query_spec.rb b/spec/lib/topic_query_spec.rbindex ace097e64e9..2e4e6c55fc3 100644--- a/spec/lib/topic_query_spec.rb+++ b/spec/lib/topic_query_spec.rb@@ -1647,14 +1647,10 @@ RSpec.describe TopicQuery doendend- context "when logged in and user is part of the `experimental_new_new_view_groups` site setting groups" do- fab!(:group)+ context "when unified new is enabled" dofab!(:topic)- before do- SiteSetting.experimental_new_new_view_groups = group.name- group.add(user)- end+ before { SiteSetting.enable_unified_new = true }after { clear_cache! }diff --git a/spec/lib/validators/top_menu_validator_spec.rb b/spec/lib/validators/top_menu_validator_spec.rbnew file mode 100644index 00000000000..3a02bbf103e--- /dev/null+++ b/spec/lib/validators/top_menu_validator_spec.rb@@ -0,0 +1,46 @@+# frozen_string_literal: true++RSpec.describe TopMenuValidator do+ describe "#valid_value?" do+ subject(:validator) { described_class.new }++ it "returns true for blank values" do+ expect(validator.valid_value?("")).to eq(true)+ expect(validator.valid_value?(nil)).to eq(true)+ end++ it "returns false when latest is missing" do+ expect(validator.valid_value?("categories|new")).to eq(false)+ end++ it "returns false when a choice is not in TopMenu.choices" do+ expect(validator.valid_value?("latest|random")).to eq(false)+ end++ it "returns true for a valid subset of choices that includes latest" do+ expect(validator.valid_value?("latest|new|hot|categories")).to eq(true)+ end++ it "returns false when unread is included and unified new is enabled" do+ SiteSetting.enable_unified_new = true++ expect(validator.valid_value?("latest|new|unread|hot|categories")).to eq(false)+ end++ it "returns true when unread is included and unified new is disabled" do+ SiteSetting.enable_unified_new = false++ expect(validator.valid_value?("latest|new|unread|hot|categories")).to eq(true)+ end+ end++ describe "#error_message" do+ subject(:validator) { described_class.new }++ it "returns the unread not allowed message" do+ expect(validator.error_message).to eq(+ I18n.t("site_settings.errors.top_menu_unread_not_allowed_with_unified_new"),+ )+ end+ end+enddiff --git a/spec/models/topic_tracking_state_spec.rb b/spec/models/topic_tracking_state_spec.rbindex 7f7eddb28ab..54e89971f10 100644--- a/spec/models/topic_tracking_state_spec.rb+++ b/spec/models/topic_tracking_state_spec.rb@@ -907,10 +907,8 @@ RSpec.describe TopicTrackingState doexpect(report).to eq({ new: 0, unread: 0 })end- it "respects new_new_view_enabled" do- new_new_group = Fabricate(:group)- SiteSetting.experimental_new_new_view_groups = new_new_group.name- user.groups << new_new_group+ it "respects unified_new_enabled" do+ SiteSetting.enable_unified_new = truereport = TopicTrackingState.report_totals(user)expect(report).to eq({ new: 0 })diff --git a/spec/requests/list_controller_spec.rb b/spec/requests/list_controller_spec.rbindex 339dcf955a8..f10207a4a3d 100644--- a/spec/requests/list_controller_spec.rb+++ b/spec/requests/list_controller_spec.rb@@ -1936,7 +1936,7 @@ RSpec.describe ListController doresponse.parsed_body["topic_list"]["topics"].map { |topics| topics["id"] }end- context "when the user is part of the `experimental_new_new_view_groups` site setting group" do+ context "when unified new is enabled for the user" dofab!(:category)fab!(:tag)@@ -1961,8 +1961,7 @@ RSpec.describe ListController dobefore doTopicUser.update_last_read(user, topic.id, 1, 1, 1)- SiteSetting.experimental_new_new_view_groups = group.name- group.add(user)+ SiteSetting.enable_unified_new = truesign_in(user)enddiff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rbindex 704bfb070ea..9dca2cd550b 100644--- a/spec/requests/topics_controller_spec.rb+++ b/spec/requests/topics_controller_spec.rb@@ -5777,8 +5777,7 @@ RSpec.describe TopicsController dobefore docreate_post(topic: unread_topic)create_post(topic: unread_topic)- user.groups << group- SiteSetting.experimental_new_new_view_groups = group.id+ SiteSetting.enable_unified_new = truesign_in(user)enddiff --git a/spec/system/dismissing_new_spec.rb b/spec/system/dismissing_new_spec.rbindex dd41f45ac51..f3a57a24b1e 100644--- a/spec/system/dismissing_new_spec.rb+++ b/spec/system/dismissing_new_spec.rb@@ -87,13 +87,12 @@ RSpec.describe "Dismissing New" doendend- describe "when the `experimental_new_new_view_groups` site setting is enabled" do- fab!(:group) { Fabricate(:group).tap { |g| g.add(user) } }+ describe "when unified new is enabled" dofab!(:new_topic) { Fabricate(:topic, user: user) }fab!(:post1) { create_post(user: user) }fab!(:post2) { create_post(topic: post1.topic) }- before { SiteSetting.experimental_new_new_view_groups = group.name }+ before { SiteSetting.enable_unified_new = true }it "should remove the new topic and post across sessions after the user dismisses it" dotab_1 = open_new_window(:tab)diff --git a/spec/system/topic_list/glimmer_spec.rb b/spec/system/topic_list/glimmer_spec.rbindex d1e5ba479f0..95da097f9c0 100644--- a/spec/system/topic_list/glimmer_spec.rb+++ b/spec/system/topic_list/glimmer_spec.rb@@ -19,7 +19,7 @@ describe "glimmer topic list" dodescribe "/new" doit "shows the list and the toggle buttons" do- SiteSetting.experimental_new_new_view_groups = Group::AUTO_GROUPS[:everyone]+ SiteSetting.enable_unified_new = trueFabricate(:topic)Fabricate(:new_reply_topic, current_user: user)diff --git a/spec/system/unified_new_topic_list_spec.rb b/spec/system/unified_new_topic_list_spec.rbindex c4cf6b991fe..6beb9af944a 100644--- a/spec/system/unified_new_topic_list_spec.rb+++ b/spec/system/unified_new_topic_list_spec.rb@@ -32,7 +32,7 @@ describe "Unified new topic list" doshared_examples "new list new topics and replies toggle" docontext "when unified new is enabled" do- before { SiteSetting.experimental_new_new_view_groups = group.name }+ before { SiteSetting.enable_unified_new = true }it "shows all new topics and replies by default" dovisit("/new")@@ -304,7 +304,7 @@ describe "Unified new topic list" doendcontext "when unified new is not enabled" do- before { SiteSetting.experimental_new_new_view_groups = "" }+ before { SiteSetting.enable_unified_new = false }it "doesn't show the tabs toggle" dovisit("/new")@@ -318,7 +318,7 @@ describe "Unified new topic list" docontext "when there are no new topics" dobefore do- SiteSetting.experimental_new_new_view_groups = group.name+ SiteSetting.enable_unified_new = true[new_topic, new_topic_in_category, new_topic_with_tag].each do |topic|TopicUser.update_last_read(user, topic.id, 1, 1, 1)@@ -347,7 +347,7 @@ describe "Unified new topic list" docontext "when there are no new replies" dobefore do- SiteSetting.experimental_new_new_view_groups = group.name+ SiteSetting.enable_unified_new = true[new_reply, new_reply_in_category, new_reply_with_tag].each do |topic|TopicUser.update_last_read(user, topic.id, 2, 1, 1)@@ -380,7 +380,7 @@ describe "Unified new topic list" docontext "when there's only new topics" dobefore do- SiteSetting.experimental_new_new_view_groups = group.name+ SiteSetting.enable_unified_new = true[new_reply, new_reply_in_category, new_reply_with_tag].each do |topic|TopicUser.update_last_read(user, topic.id, 2, 1, 1)@@ -409,7 +409,7 @@ describe "Unified new topic list" docontext "when there's only new replies" dobefore do- SiteSetting.experimental_new_new_view_groups = group.name+ SiteSetting.enable_unified_new = true[new_topic, new_topic_in_category, new_topic_with_tag].each do |topic|TopicUser.update_last_read(user, topic.id, 1, 1, 1)