From 561851b104562bd34fa8ef5110d73c25b9b65b0c Mon Sep 17 00:00:00 2001 From: Blake Erickson Date: Thu, 18 Jan 2024 16:36:18 -0700 Subject: [PATCH] FEATURE: Add hot as a homepage option (#25325) --- .../discourse/app/controllers/preferences/interface.js | 4 ++++ app/models/user_option.rb | 6 ++++++ config/locales/client.en.yml | 1 + config/site_settings.yml | 2 ++ 4 files changed, 13 insertions(+) diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/interface.js b/app/assets/javascripts/discourse/app/controllers/preferences/interface.js index 979a91678bb..19003db66bd 100644 --- a/app/assets/javascripts/discourse/app/controllers/preferences/interface.js +++ b/app/assets/javascripts/discourse/app/controllers/preferences/interface.js @@ -44,6 +44,10 @@ export default Controller.extend({ this._super(...arguments); this.set("selectedDarkColorSchemeId", this.session.userDarkSchemeId); + + if (this.siteSettings.experimental_hot_topics) { + USER_HOMES[8] = "hot"; + } }, @discourseComputed("makeThemeDefault") diff --git a/app/models/user_option.rb b/app/models/user_option.rb index 1fb652a271f..b62b2d42431 100644 --- a/app/models/user_option.rb +++ b/app/models/user_option.rb @@ -185,6 +185,12 @@ class UserOption < ActiveRecord::Base "bookmarks" when 7 "unseen" + when 8 + if SiteSetting.experimental_hot_topics + "hot" + else + SiteSetting.homepage + end else SiteSetting.homepage end diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index dbdae947324..fb28c97ae7a 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2956,6 +2956,7 @@ en: bookmarks: "You have no bookmarked topics yet." category: "There are no %{category} topics." top: "There are no top topics." + hot: "There are no hot topics." filter: "There are no topics." educate: new: '

Your new topics will appear here. By default, topics are considered new and will show a indicator if they were created in the last 2 days.

Visit your preferences to change this.

' diff --git a/config/site_settings.yml b/config/site_settings.yml index e781553261a..14bbfc787ab 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -189,6 +189,7 @@ basic: - read - posted - bookmarks + - hot post_menu: client: true type: list @@ -3121,6 +3122,7 @@ dashboard: experimental_hot_topics: hidden: true default: false + client: true hot_topics_gravity: hidden: true default: 1.2