From 979325c500df6143e3e257b665fd3998f8bd1ca9 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 13 Jan 2025 09:36:11 +0000 Subject: [PATCH] DEV: Move `discourse-common/` helpers to `discourse/` (#30728) `discourse-common` was created in the past to share logic between the 'wizard' app and the main 'discourse' app. Since then, the wizard has been consolidated into the main app, so the separation of `discourse-common` is no longer useful. This commit moves `discourse-common/helpers/*` into `discourse/helpers/*`, removes `discourse-common` from the Ember resolver config, and adds shims for the imports. --- .../components/admin-config-area-card.gjs | 2 +- .../admin/addon/components/admin-notice.gjs | 2 +- .../components/admin-plugins-list-item.gjs | 2 +- .../admin/addon/components/admin-reports.gjs | 2 +- .../components/admin-section-landing-item.gjs | 2 +- .../components/dashboard-new-feature-item.gjs | 2 +- .../addon/components/dashboard-problems.gjs | 2 +- .../addon/components/install-theme-item.gjs | 2 +- .../addon/components/modal/install-theme.gjs | 2 +- .../editor/child-tree-node.gjs | 2 +- .../editor/child-tree.gjs | 2 +- .../schema-theme-setting/editor/tree-node.gjs | 2 +- .../schema-theme-setting/editor/tree.gjs | 2 +- .../admin/addon/components/tags-uploader.gjs | 2 +- .../addon/components/themes-grid-card.gjs | 2 +- .../addon/components/themes-list-item.gjs | 2 +- .../discourse-common/addon/resolver.js | 1 - app/assets/javascripts/discourse/app/app.js | 1 + .../discourse/app/components/about-page.gjs | 2 +- .../app/components/actions-summary.gjs | 2 +- .../discourse/app/components/back-button.gjs | 2 +- .../discourse/app/components/badge-card.gjs | 2 +- .../app/components/bookmark-icon.gjs | 2 +- .../app/components/bookmark-menu.gjs | 2 +- .../bulk-select-topics-dropdown.gjs | 2 +- .../app/components/d-breadcrumbs-item.gjs | 2 +- .../discourse/app/components/d-button.gjs | 2 +- .../app/components/d-toggle-switch.gjs | 2 +- .../app/components/discourse-banner.gjs | 2 +- .../app/components/emoji-picker/index.gjs | 2 +- .../discourse/app/components/filter-input.gjs | 2 +- .../form-template-field/multi-select.gjs | 2 +- .../components/form-template-field/upload.gjs | 2 +- .../components/header/home-logo-contents.gjs | 2 +- .../app/components/header/sidebar-toggle.gjs | 2 +- .../components/header/topic/featured-link.gjs | 2 +- .../app/components/header/topic/info.gjs | 2 +- .../components/header/topic/participant.gjs | 2 +- .../app/components/header/topic/status.gjs | 2 +- .../header/user-dropdown/notifications.gjs | 2 +- .../discourse/app/components/input-tip.gjs | 2 +- .../app/components/navigation-bar.gjs | 2 +- .../app/components/notifications-tracking.gjs | 2 +- .../app/components/post/menu/buttons/like.gjs | 2 +- .../components/post/menu/buttons/replies.gjs | 2 +- .../app/components/powered-by-discourse.gjs | 2 +- .../app/components/private-message-glyph.gjs | 2 +- .../components/reviewable-created-by-name.gjs | 2 +- .../app/components/reviewable-created-by.gjs | 2 +- .../app/components/sidebar/back-to-forum.gjs | 2 +- .../sidebar/edit-navigation-menu/modal.gjs | 2 +- .../components/sidebar/more-section-links.gjs | 2 +- .../components/sidebar/section-form-link.gjs | 2 +- .../sidebar/section-link-button.gjs | 2 +- .../sidebar/section-link-prefix.gjs | 2 +- .../app/components/sidebar/section-link.gjs | 2 +- .../app/components/sidebar/section.gjs | 2 +- .../app/components/table-header-toggle.gjs | 2 +- .../app/components/topic-admin-menu.gjs | 2 +- .../app/components/topic-list/action-list.gjs | 2 +- .../topic-list/header/bulk-select-cell.gjs | 2 +- .../topic-list/header/sortable-column.gjs | 2 +- .../components/topic-list/item/likes-cell.gjs | 2 +- .../topic-list/item/op-likes-cell.gjs | 2 +- .../topic-list/participant-groups.gjs | 2 +- .../topic-list/unread-indicator.gjs | 2 +- .../topic-map/private-message-map.gjs | 2 +- .../topic-map/topic-map-summary.gjs | 2 +- .../discourse/app/components/topic-status.gjs | 2 +- .../components/topic-timeline/container.gjs | 2 +- .../app/components/user-flag-percentage.gjs | 2 +- .../app/components/user-menu/icon-avatar.gjs | 2 +- .../discourse/app/components/user-stat.gjs | 2 +- .../app/discourse-common-loader-shims.js | 37 +++++++++++++++++++ .../app/form-kit/components/fk/alert.gjs | 2 +- .../form-kit/components/fk/control/menu.gjs | 2 +- .../form-kit/components/fk/errors-summary.gjs | 2 +- .../app/form-kit/components/fk/errors.gjs | 2 +- .../app}/helpers/base-path.js | 0 .../app}/helpers/base-url.js | 0 .../app}/helpers/bound-i18n.js | 0 .../app}/helpers/component-for-collection.js | 0 .../app}/helpers/component-for-row.js | 0 .../addon => discourse/app}/helpers/d-icon.js | 0 .../app}/helpers/fa-icon.js | 0 .../app}/helpers/get-url.js | 0 .../app}/helpers/html-safe.js | 0 .../app}/helpers/i18n-yes-no.js | 0 .../addon => discourse/app}/helpers/i18n.js | 0 .../plugin-outlet-debug/args-table.gjs | 2 +- .../dev-tools/plugin-outlet-debug/button.gjs | 2 +- .../plugin-outlet-debug/outlet-info.gjs | 2 +- .../app/static/dev-tools/safe-mode/button.gjs | 2 +- .../app/static/dev-tools/toolbar.gjs | 2 +- .../dev-tools/verbose-localization/button.gjs | 2 +- .../static/wizard/components/fields/radio.gjs | 2 +- .../addon/components/d-default-toast.gjs | 2 +- .../float-kit/addon/components/d-tooltip.gjs | 2 +- .../category-drop-more-collection.gjs | 2 +- 99 files changed, 123 insertions(+), 86 deletions(-) create mode 100644 app/assets/javascripts/discourse/app/discourse-common-loader-shims.js rename app/assets/javascripts/{discourse-common/addon => discourse/app}/helpers/base-path.js (100%) rename app/assets/javascripts/{discourse-common/addon => discourse/app}/helpers/base-url.js (100%) rename app/assets/javascripts/{discourse-common/addon => discourse/app}/helpers/bound-i18n.js (100%) rename app/assets/javascripts/{discourse-common/addon => discourse/app}/helpers/component-for-collection.js (100%) rename app/assets/javascripts/{discourse-common/addon => discourse/app}/helpers/component-for-row.js (100%) rename app/assets/javascripts/{discourse-common/addon => discourse/app}/helpers/d-icon.js (100%) rename app/assets/javascripts/{discourse-common/addon => discourse/app}/helpers/fa-icon.js (100%) rename app/assets/javascripts/{discourse-common/addon => discourse/app}/helpers/get-url.js (100%) rename app/assets/javascripts/{discourse-common/addon => discourse/app}/helpers/html-safe.js (100%) rename app/assets/javascripts/{discourse-common/addon => discourse/app}/helpers/i18n-yes-no.js (100%) rename app/assets/javascripts/{discourse-common/addon => discourse/app}/helpers/i18n.js (100%) diff --git a/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs b/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs index 6eb1f5a4481..c9f317fa9c9 100644 --- a/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs +++ b/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs @@ -2,7 +2,7 @@ import Component from "@glimmer/component"; import { tracked } from "@glimmer/tracking"; import { action } from "@ember/object"; import DButton from "discourse/components/d-button"; -import icon from "discourse-common/helpers/d-icon"; +import icon from "discourse/helpers/d-icon"; import { i18n } from "discourse-i18n"; export default class AdminConfigAreaCard extends Component { diff --git a/app/assets/javascripts/admin/addon/components/admin-notice.gjs b/app/assets/javascripts/admin/addon/components/admin-notice.gjs index 59b6703d304..4e31fcaa23f 100644 --- a/app/assets/javascripts/admin/addon/components/admin-notice.gjs +++ b/app/assets/javascripts/admin/addon/components/admin-notice.gjs @@ -3,7 +3,7 @@ import { action } from "@ember/object"; import { service } from "@ember/service"; import { htmlSafe } from "@ember/template"; import DButton from "discourse/components/d-button"; -import icon from "discourse-common/helpers/d-icon"; +import icon from "discourse/helpers/d-icon"; export default class AdminNotice extends Component { @service currentUser; diff --git a/app/assets/javascripts/admin/addon/components/admin-plugins-list-item.gjs b/app/assets/javascripts/admin/addon/components/admin-plugins-list-item.gjs index 6176115332d..4aba0ef6d62 100644 --- a/app/assets/javascripts/admin/addon/components/admin-plugins-list-item.gjs +++ b/app/assets/javascripts/admin/addon/components/admin-plugins-list-item.gjs @@ -6,8 +6,8 @@ import { LinkTo } from "@ember/routing"; import { service } from "@ember/service"; import DToggleSwitch from "discourse/components/d-toggle-switch"; import PluginOutlet from "discourse/components/plugin-outlet"; +import icon from "discourse/helpers/d-icon"; import { popupAjaxError } from "discourse/lib/ajax-error"; -import icon from "discourse-common/helpers/d-icon"; import { i18n } from "discourse-i18n"; import SiteSetting from "admin/models/site-setting"; import PluginCommitHash from "./plugin-commit-hash"; diff --git a/app/assets/javascripts/admin/addon/components/admin-reports.gjs b/app/assets/javascripts/admin/addon/components/admin-reports.gjs index 48f8a35d563..67f87b19465 100644 --- a/app/assets/javascripts/admin/addon/components/admin-reports.gjs +++ b/app/assets/javascripts/admin/addon/components/admin-reports.gjs @@ -6,8 +6,8 @@ import { LinkTo } from "@ember/routing"; import { service } from "@ember/service"; import { htmlSafe } from "@ember/template"; import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner"; +import dIcon from "discourse/helpers/d-icon"; import { ajax } from "discourse/lib/ajax"; -import dIcon from "discourse-common/helpers/d-icon"; import { bind } from "discourse-common/utils/decorators"; import { i18n } from "discourse-i18n"; diff --git a/app/assets/javascripts/admin/addon/components/admin-section-landing-item.gjs b/app/assets/javascripts/admin/addon/components/admin-section-landing-item.gjs index 8bd55918e44..34642b4f0db 100644 --- a/app/assets/javascripts/admin/addon/components/admin-section-landing-item.gjs +++ b/app/assets/javascripts/admin/addon/components/admin-section-landing-item.gjs @@ -7,7 +7,7 @@ import { PrimaryButton, } from "discourse/components/d-page-action-button"; import concatClass from "discourse/helpers/concat-class"; -import dIcon from "discourse-common/helpers/d-icon"; +import dIcon from "discourse/helpers/d-icon"; import { i18n } from "discourse-i18n"; export default class AdminSectionLandingItem extends Component { diff --git a/app/assets/javascripts/admin/addon/components/dashboard-new-feature-item.gjs b/app/assets/javascripts/admin/addon/components/dashboard-new-feature-item.gjs index a086209a3e1..a93fe4368c2 100644 --- a/app/assets/javascripts/admin/addon/components/dashboard-new-feature-item.gjs +++ b/app/assets/javascripts/admin/addon/components/dashboard-new-feature-item.gjs @@ -7,9 +7,9 @@ import { htmlSafe } from "@ember/template"; import { and, not } from "truth-helpers"; import CookText from "discourse/components/cook-text"; import DToggleSwitch from "discourse/components/d-toggle-switch"; +import dIcon from "discourse/helpers/d-icon"; import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; -import dIcon from "discourse-common/helpers/d-icon"; import { i18n } from "discourse-i18n"; import DTooltip from "float-kit/components/d-tooltip"; diff --git a/app/assets/javascripts/admin/addon/components/dashboard-problems.gjs b/app/assets/javascripts/admin/addon/components/dashboard-problems.gjs index 6db1c8ac0f2..61cb594303c 100644 --- a/app/assets/javascripts/admin/addon/components/dashboard-problems.gjs +++ b/app/assets/javascripts/admin/addon/components/dashboard-problems.gjs @@ -5,9 +5,9 @@ import { eq } from "truth-helpers"; import ConditionalLoadingSection from "discourse/components/conditional-loading-section"; import DButton from "discourse/components/d-button"; import concatClass from "discourse/helpers/concat-class"; +import icon from "discourse/helpers/d-icon"; import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; -import icon from "discourse-common/helpers/d-icon"; import { i18n } from "discourse-i18n"; import AdminNotice from "admin/components/admin-notice"; diff --git a/app/assets/javascripts/admin/addon/components/install-theme-item.gjs b/app/assets/javascripts/admin/addon/components/install-theme-item.gjs index e53cfefa663..a5a2f2b01bc 100644 --- a/app/assets/javascripts/admin/addon/components/install-theme-item.gjs +++ b/app/assets/javascripts/admin/addon/components/install-theme-item.gjs @@ -1,5 +1,5 @@ import RadioButton from "discourse/components/radio-button"; -import dIcon from "discourse-common/helpers/d-icon"; +import dIcon from "discourse/helpers/d-icon"; import { i18n } from "discourse-i18n"; const InstallThemeItem =