A platform for community discussion. Free, open, simple.
UX: Show message in page when no new features are found (#37149)
Penar Musaraj3d577461f828
diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 30506063db9..d982f8b3371 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -6298,7 +6298,7 @@ en:new_features:title: "What's new?"subtitle: "We are releasing new features and improvements all the time. This page covers the highlights, but you can click 'Learn more' to see extensive release notes."- previous_announcements: "You can see previous new feature announcements on <a href='%{url}' target='_blank'>Discourse Meta</a>"+ no_new_features_found: "There was an error loading the feed. You can see previous new feature announcements on <a href='%{url}' target='_blank'>the Discourse Meta community</a>."learn_more: "Learn more..."experimental: "Experimental"only_experiments: "Only show experimental features"diff --git a/frontend/discourse/admin/components/dashboard-new-features.gjs b/frontend/discourse/admin/components/dashboard-new-features.gjsindex 8cd61e42ac3..64301ac4503 100644--- a/frontend/discourse/admin/components/dashboard-new-features.gjs+++ b/frontend/discourse/admin/components/dashboard-new-features.gjs@@ -35,6 +35,12 @@ export default class DashboardNewFeatures extends Component {const json = await ajax("/admin/whats-new.json?force_refresh=" + opts.forceRefresh);++ if (!json.new_features || json.new_features.length === 0) {+ this.newFeatures = {};+ return;+ }+this.newFeatures = json.new_features.reduce((acc, feature) => {const key = moment(feature.released_at || feature.created_at).format("YYYY-MM"@@ -115,7 +121,7 @@ export default class DashboardNewFeatures extends Component {{{else}}<AdminConfigAreaEmptyList@emptyLabelTranslated={{i18n- "admin.dashboard.new_features.previous_announcements"+ "admin.dashboard.new_features.no_new_features_found"url="https://meta.discourse.org/tags/c/announcements/67/release-notes"}}/>diff --git a/spec/system/admin_whats_new_spec.rb b/spec/system/admin_whats_new_spec.rbindex d908c0b2777..ae266c72e3c 100644--- a/spec/system/admin_whats_new_spec.rb+++ b/spec/system/admin_whats_new_spec.rb@@ -14,6 +14,12 @@ describe "Admin What's New Page", type: :system doDiscourse.redis.set("new_features", MultiJson.dump(payload))end+ it "shows an error message when the backend returns an empty list" do+ set_new_features_payload(nil)+ whats_new_page.visit+ expect(whats_new_page).to have_content("There was an error loading the feed.")+ end+it "displays a new feature indicator on the sidebar and clears it when navigating to what's new" doDiscourseUpdates.stubs(:has_unseen_features?).returns(true)set_new_features_payload(