From 4594ce2723f67e945ba0ed61e7930dffb80ec7a3 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Fri, 22 Jul 2022 15:20:01 +0800 Subject: [PATCH] UX: Rename Sidebar 'Topics' section to 'Community' (#17605) Product decision to rename as not all links under the section falls under the topics umbrella --- ...topics-section.js => community-section.js} | 12 +-- .../discourse/app/lib/plugin-api.js | 4 +- .../base-section-link.js | 2 +- .../bookmarked-section-link.js | 6 +- .../everything-section-link.js | 6 +- .../my-posts-section-link.js | 8 +- .../tracked-section-link.js | 6 +- ...s.js => custom-community-section-links.js} | 4 +- ...pics-section.hbs => community-section.hbs} | 8 +- .../templates/components/sidebar/sections.hbs | 2 +- ...t.js => sidebar-community-section-test.js} | 102 +++++++++++------- .../tests/acceptance/sidebar-mobile-test.js | 2 +- .../discourse/tests/helpers/qunit-helpers.js | 2 +- config/locales/client.en.yml | 4 +- 14 files changed, 94 insertions(+), 74 deletions(-) rename app/assets/javascripts/discourse/app/components/sidebar/{topics-section.js => community-section.js} (74%) rename app/assets/javascripts/discourse/app/lib/sidebar/{topics-section => community-section}/base-section-link.js (96%) rename app/assets/javascripts/discourse/app/lib/sidebar/{topics-section => community-section}/bookmarked-section-link.js (55%) rename app/assets/javascripts/discourse/app/lib/sidebar/{topics-section => community-section}/everything-section-link.js (86%) rename app/assets/javascripts/discourse/app/lib/sidebar/{topics-section => community-section}/my-posts-section-link.js (78%) rename app/assets/javascripts/discourse/app/lib/sidebar/{topics-section => community-section}/tracked-section-link.js (87%) rename app/assets/javascripts/discourse/app/lib/sidebar/{custom-topics-section-links.js => custom-community-section-links.js} (86%) rename app/assets/javascripts/discourse/app/templates/components/sidebar/{topics-section.hbs => community-section.hbs} (72%) rename app/assets/javascripts/discourse/tests/acceptance/{sidebar-topics-section-test.js => sidebar-community-section-test.js} (84%) diff --git a/app/assets/javascripts/discourse/app/components/sidebar/topics-section.js b/app/assets/javascripts/discourse/app/components/sidebar/community-section.js similarity index 74% rename from app/assets/javascripts/discourse/app/components/sidebar/topics-section.js rename to app/assets/javascripts/discourse/app/components/sidebar/community-section.js index 6a3de9ddc94..218809bc640 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/topics-section.js +++ b/app/assets/javascripts/discourse/app/components/sidebar/community-section.js @@ -2,11 +2,11 @@ import GlimmerComponent from "discourse/components/glimmer"; import Composer from "discourse/models/composer"; import { getOwner } from "discourse-common/lib/get-owner"; import PermissionType from "discourse/models/permission-type"; -import { customSectionLinks } from "discourse/lib/sidebar/custom-topics-section-links"; -import EverythingSectionLink from "discourse/lib/sidebar/topics-section/everything-section-link"; -import TrackedSectionLink from "discourse/lib/sidebar/topics-section/tracked-section-link"; -import BookmarkedSectionLink from "discourse/lib/sidebar/topics-section/bookmarked-section-link"; -import MyPostsSectionLink from "discourse/lib/sidebar/topics-section/my-posts-section-link"; +import { customSectionLinks } from "discourse/lib/sidebar/custom-community-section-links"; +import EverythingSectionLink from "discourse/lib/sidebar/community-section/everything-section-link"; +import TrackedSectionLink from "discourse/lib/sidebar/community-section/tracked-section-link"; +import BookmarkedSectionLink from "discourse/lib/sidebar/community-section/bookmarked-section-link"; +import MyPostsSectionLink from "discourse/lib/sidebar/community-section/my-posts-section-link"; import { action } from "@ember/object"; import { next } from "@ember/runloop"; @@ -18,7 +18,7 @@ const DEFAULT_SECTION_LINKS = [ MyPostsSectionLink, ]; -export default class SidebarTopicsSection extends GlimmerComponent { +export default class SidebarCommunitySection extends GlimmerComponent { configuredSectionLinks = [...DEFAULT_SECTION_LINKS, ...customSectionLinks]; sectionLinks = this.configuredSectionLinks.map((sectionLinkClass) => { diff --git a/app/assets/javascripts/discourse/app/lib/plugin-api.js b/app/assets/javascripts/discourse/app/lib/plugin-api.js index a2a1c45812b..e0897897020 100644 --- a/app/assets/javascripts/discourse/app/lib/plugin-api.js +++ b/app/assets/javascripts/discourse/app/lib/plugin-api.js @@ -94,7 +94,7 @@ import { import { CUSTOM_USER_SEARCH_OPTIONS } from "select-kit/components/user-chooser"; import { downloadCalendar } from "discourse/lib/download-calendar"; import { consolePrefix } from "discourse/lib/source-identifier"; -import { addSectionLink } from "discourse/lib/sidebar/custom-topics-section-links"; +import { addSectionLink } from "discourse/lib/sidebar/custom-community-section-links"; import { addSidebarSection } from "discourse/lib/sidebar/custom-sections"; // If you add any methods to the API ensure you bump up the version number @@ -1628,7 +1628,7 @@ class PluginApi { /** * EXPERIMENTAL. Do not use. * Support for adding a link under Sidebar topics section by returning a class which extends from the BaseSectionLink - * class interface. See `lib/sidebar/topics-section/base-section-link.js` for documentation on the BaseSectionLink class + * class interface. See `lib/sidebar/community-section/base-section-link.js` for documentation on the BaseSectionLink class * interface. * * ``` diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/topics-section/base-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/community-section/base-section-link.js similarity index 96% rename from app/assets/javascripts/discourse/app/lib/sidebar/topics-section/base-section-link.js rename to app/assets/javascripts/discourse/app/lib/sidebar/community-section/base-section-link.js index fa217833ef9..69c6e56cdfb 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/topics-section/base-section-link.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/community-section/base-section-link.js @@ -9,7 +9,7 @@ export default class BaseSectionLink { } /** - * Called when topics-section component is torn down. + * Called when community-section component is torn down. */ teardown() {} diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/topics-section/bookmarked-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/community-section/bookmarked-section-link.js similarity index 55% rename from app/assets/javascripts/discourse/app/lib/sidebar/topics-section/bookmarked-section-link.js rename to app/assets/javascripts/discourse/app/lib/sidebar/community-section/bookmarked-section-link.js index bee631e2b60..eedc531533a 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/topics-section/bookmarked-section-link.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/community-section/bookmarked-section-link.js @@ -1,6 +1,6 @@ import I18n from "I18n"; -import BaseSectionLink from "discourse/lib/sidebar/topics-section/base-section-link"; +import BaseSectionLink from "discourse/lib/sidebar/community-section/base-section-link"; export default class BookmarkedSectionLink extends BaseSectionLink { get name() { @@ -16,10 +16,10 @@ export default class BookmarkedSectionLink extends BaseSectionLink { } get title() { - return I18n.t("sidebar.sections.topics.links.bookmarked.title"); + return I18n.t("sidebar.sections.community.links.bookmarked.title"); } get text() { - return I18n.t("sidebar.sections.topics.links.bookmarked.content"); + return I18n.t("sidebar.sections.community.links.bookmarked.content"); } } diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/topics-section/everything-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/community-section/everything-section-link.js similarity index 86% rename from app/assets/javascripts/discourse/app/lib/sidebar/topics-section/everything-section-link.js rename to app/assets/javascripts/discourse/app/lib/sidebar/community-section/everything-section-link.js index 8192a75f688..86ce91d06c8 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/topics-section/everything-section-link.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/community-section/everything-section-link.js @@ -2,7 +2,7 @@ import I18n from "I18n"; import { tracked } from "@glimmer/tracking"; import { bind } from "discourse-common/utils/decorators"; -import BaseSectionLink from "discourse/lib/sidebar/topics-section/base-section-link"; +import BaseSectionLink from "discourse/lib/sidebar/community-section/base-section-link"; export default class EverythingSectionLink extends BaseSectionLink { @tracked totalUnread = 0; @@ -41,11 +41,11 @@ export default class EverythingSectionLink extends BaseSectionLink { } get title() { - return I18n.t("sidebar.sections.topics.links.everything.title"); + return I18n.t("sidebar.sections.community.links.everything.title"); } get text() { - return I18n.t("sidebar.sections.topics.links.everything.content"); + return I18n.t("sidebar.sections.community.links.everything.content"); } get currentWhen() { diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/topics-section/my-posts-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/community-section/my-posts-section-link.js similarity index 78% rename from app/assets/javascripts/discourse/app/lib/sidebar/topics-section/my-posts-section-link.js rename to app/assets/javascripts/discourse/app/lib/sidebar/community-section/my-posts-section-link.js index 703bce8cf5c..72951911478 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/topics-section/my-posts-section-link.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/community-section/my-posts-section-link.js @@ -1,7 +1,7 @@ import I18n from "I18n"; import { tracked } from "@glimmer/tracking"; -import BaseSectionLink from "discourse/lib/sidebar/topics-section/base-section-link"; +import BaseSectionLink from "discourse/lib/sidebar/community-section/base-section-link"; const USER_DRAFTS_CHANGED_EVENT = "user-drafts:changed"; @@ -44,16 +44,16 @@ export default class MyPostsSectionLink extends BaseSectionLink { } get title() { - return I18n.t("sidebar.sections.topics.links.my_posts.title"); + return I18n.t("sidebar.sections.community.links.my_posts.title"); } get text() { - return I18n.t("sidebar.sections.topics.links.my_posts.content"); + return I18n.t("sidebar.sections.community.links.my_posts.content"); } get badgeText() { if (this._hasDraft) { - return I18n.t("sidebar.sections.topics.links.my_posts.draft_count", { + return I18n.t("sidebar.sections.community.links.my_posts.draft_count", { count: this.draftCount, }); } diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/topics-section/tracked-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/community-section/tracked-section-link.js similarity index 87% rename from app/assets/javascripts/discourse/app/lib/sidebar/topics-section/tracked-section-link.js rename to app/assets/javascripts/discourse/app/lib/sidebar/community-section/tracked-section-link.js index 997903c91a7..25d751eba74 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/topics-section/tracked-section-link.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/community-section/tracked-section-link.js @@ -2,7 +2,7 @@ import I18n from "I18n"; import { tracked } from "@glimmer/tracking"; import { bind } from "discourse-common/utils/decorators"; -import BaseSectionLink from "discourse/lib/sidebar/topics-section/base-section-link"; +import BaseSectionLink from "discourse/lib/sidebar/community-section/base-section-link"; import { isTrackedTopic } from "discourse/lib/topic-list-tracked-filter"; export default class TrackedSectionLink extends BaseSectionLink { @@ -45,11 +45,11 @@ export default class TrackedSectionLink extends BaseSectionLink { } get title() { - return I18n.t("sidebar.sections.topics.links.tracked.title"); + return I18n.t("sidebar.sections.community.links.tracked.title"); } get text() { - return I18n.t("sidebar.sections.topics.links.tracked.content"); + return I18n.t("sidebar.sections.community.links.tracked.content"); } get currentWhen() { diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/custom-topics-section-links.js b/app/assets/javascripts/discourse/app/lib/sidebar/custom-community-section-links.js similarity index 86% rename from app/assets/javascripts/discourse/app/lib/sidebar/custom-topics-section-links.js rename to app/assets/javascripts/discourse/app/lib/sidebar/custom-community-section-links.js index 3d5384c80b0..eb674d16279 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/custom-topics-section-links.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/custom-community-section-links.js @@ -1,4 +1,4 @@ -import BaseSectionLink from "discourse/lib/sidebar/topics-section/base-section-link"; +import BaseSectionLink from "discourse/lib/sidebar/community-section/base-section-link"; export let customSectionLinks = []; @@ -8,7 +8,7 @@ export let customSectionLinks = []; * @param {BaseSectionLink} baseSectionLink Factory class to inherit from. * @returns {BaseSectionLink} A class that extends BaseSectionLink. * - * @param {(addTopicsSectionLinkCallback|Object)} arg - A callback function or an Object. + * @param {(addSectionLinkCallback|Object)} arg - A callback function or an Object. * @param {string} arg.name - The name of the link. Needs to be dasherized and lowercase. * @param {string} arg.route - The Ember route of the link. * @param {string} arg.title - The title attribute for the link. diff --git a/app/assets/javascripts/discourse/app/templates/components/sidebar/topics-section.hbs b/app/assets/javascripts/discourse/app/templates/components/sidebar/community-section.hbs similarity index 72% rename from app/assets/javascripts/discourse/app/templates/components/sidebar/topics-section.hbs rename to app/assets/javascripts/discourse/app/templates/components/sidebar/community-section.hbs index 1eb7111759b..5a17d28bd21 100644 --- a/app/assets/javascripts/discourse/app/templates/components/sidebar/topics-section.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/sidebar/community-section.hbs @@ -1,11 +1,11 @@ {{#each this.sectionLinks as |sectionLink|}} diff --git a/app/assets/javascripts/discourse/app/templates/components/sidebar/sections.hbs b/app/assets/javascripts/discourse/app/templates/components/sidebar/sections.hbs index bf801b996ac..f9793138d8e 100644 --- a/app/assets/javascripts/discourse/app/templates/components/sidebar/sections.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/sidebar/sections.hbs @@ -1,5 +1,5 @@