A platform for community discussion. Free, open, simple.
DEV: Deprecate string-based resolution of empty-state-components (#42517)
David Taylorf74405cd90e4
diff --git a/frontend/discourse/app/components/user-menu/bookmarks-list.js b/frontend/discourse/app/components/user-menu/bookmarks-list.jsindex fa6c4143fd9..5df6ae9bb3c 100644--- a/frontend/discourse/app/components/user-menu/bookmarks-list.js+++ b/frontend/discourse/app/components/user-menu/bookmarks-list.js@@ -1,3 +1,4 @@+import UserMenuBookmarksListEmptyState from "discourse/components/user-menu/bookmarks-list-empty-state";import UserMenuNotificationsList from "discourse/components/user-menu/notifications-list";import { ajax } from "discourse/lib/ajax";import UserMenuBookmarkItem from "discourse/lib/user-menu/bookmark-item";@@ -32,7 +33,7 @@ export default class UserMenuBookmarksList extends UserMenuNotificationsList {}get emptyStateComponent() {- return "user-menu/bookmarks-list-empty-state";+ return UserMenuBookmarksListEmptyState;}get #unreadBookmarkRemindersCount() {diff --git a/frontend/discourse/app/components/user-menu/items-list.gjs b/frontend/discourse/app/components/user-menu/items-list.gjsindex abef3bb06d7..82bdfc2c518 100644--- a/frontend/discourse/app/components/user-menu/items-list.gjs+++ b/frontend/discourse/app/components/user-menu/items-list.gjs@@ -5,8 +5,10 @@ import { action } from "@ember/object";import { getOwner } from "@ember/owner";import { service } from "@ember/service";import PluginOutlet from "discourse/components/plugin-outlet";+import UserMenuItemsListEmptyState from "discourse/components/user-menu/items-list-empty-state";import MenuItem from "discourse/components/user-menu/menu-item";import lazyHash from "discourse/helpers/lazy-hash";+import deprecated from "discourse/lib/deprecated";import DButton from "discourse/ui-kit/d-button";import dIcon from "discourse/ui-kit/helpers/d-icon";import { i18n } from "discourse-i18n";@@ -35,12 +37,16 @@ export default class UserMenuItemsList extends Component {get dismissTitle() {}get emptyStateComponent() {- return "user-menu/items-list-empty-state";+ return UserMenuItemsListEmptyState;}get resolvedEmptyStateComponent() {const component = this.emptyStateComponent;if (typeof component === "string") {+ deprecated(+ `user-menu emptyStateComponent must be a component class (${this.constructor.name} returned the string ${JSON.stringify(component)})`,+ { id: "discourse.user-menu.empty-state-component-class" }+ );return getOwner(this).resolveRegistration(`component:${component}`);} else {return component;diff --git a/frontend/discourse/app/components/user-menu/likes-notifications-list.js b/frontend/discourse/app/components/user-menu/likes-notifications-list.jsindex a23f5354780..84db802b639 100644--- a/frontend/discourse/app/components/user-menu/likes-notifications-list.js+++ b/frontend/discourse/app/components/user-menu/likes-notifications-list.js@@ -1,3 +1,4 @@+import UserMenuLikesListEmptyState from "discourse/components/user-menu/likes-list-empty-state";import UserMenuNotificationsList from "discourse/components/user-menu/notifications-list";export default class UserMenuLikesNotificationsList extends UserMenuNotificationsList {@@ -10,6 +11,6 @@ export default class UserMenuLikesNotificationsList extends UserMenuNotification}get emptyStateComponent() {- return "user-menu/likes-list-empty-state";+ return UserMenuLikesListEmptyState;}}diff --git a/frontend/discourse/app/components/user-menu/messages-list.js b/frontend/discourse/app/components/user-menu/messages-list.jsindex 7022e68a96c..2a8437b0bf4 100644--- a/frontend/discourse/app/components/user-menu/messages-list.js+++ b/frontend/discourse/app/components/user-menu/messages-list.js@@ -1,4 +1,5 @@import { service } from "@ember/service";+import UserMenuMessagesListEmptyState from "discourse/components/user-menu/messages-list-empty-state";import UserMenuNotificationsList from "discourse/components/user-menu/notifications-list";import { ajax } from "discourse/lib/ajax";import UserMenuMessageItem from "discourse/lib/user-menu/message-item";@@ -36,7 +37,7 @@ export default class UserMenuMessagesList extends UserMenuNotificationsList {}get emptyStateComponent() {- return "user-menu/messages-list-empty-state";+ return UserMenuMessagesListEmptyState;}get #unreadMessagesNotifications() {diff --git a/frontend/discourse/app/components/user-menu/notifications-list.js b/frontend/discourse/app/components/user-menu/notifications-list.jsindex 8dd58cd71be..6f7bbfb7e7b 100644--- a/frontend/discourse/app/components/user-menu/notifications-list.js+++ b/frontend/discourse/app/components/user-menu/notifications-list.js@@ -3,6 +3,7 @@ import { cancel } from "@ember/runloop";import { service } from "@ember/service";import DismissNotificationConfirmationModal from "discourse/components/modal/dismiss-notification-confirmation";import UserMenuItemsList from "discourse/components/user-menu/items-list";+import UserMenuNotificationsListEmptyState from "discourse/components/user-menu/notifications-list-empty-state";import { ajax } from "discourse/lib/ajax";import { MAX_NOTIFICATIONS_LIMIT_PARAMS } from "discourse/lib/constants";import discourseDebounce from "discourse/lib/debounce";@@ -101,7 +102,7 @@ export default class UserMenuNotificationsList extends UserMenuItemsList {get emptyStateComponent() {if (this.constructor === UserMenuNotificationsList) {- return "user-menu/notifications-list-empty-state";+ return UserMenuNotificationsListEmptyState;} else {return super.emptyStateComponent;}diff --git a/frontend/discourse/app/components/user-menu/other-notifications-list.js b/frontend/discourse/app/components/user-menu/other-notifications-list.jsindex edf03c55536..72f5159fc80 100644--- a/frontend/discourse/app/components/user-menu/other-notifications-list.js+++ b/frontend/discourse/app/components/user-menu/other-notifications-list.js@@ -1,4 +1,5 @@import UserMenuNotificationsList from "discourse/components/user-menu/notifications-list";+import UserMenuOtherNotificationsListEmptyState from "discourse/components/user-menu/other-notifications-list-empty-state";export default class UserMenuOtherNotificationsList extends UserMenuNotificationsList {get dismissTypes() {@@ -6,7 +7,7 @@ export default class UserMenuOtherNotificationsList extends UserMenuNotification}get emptyStateComponent() {- return "user-menu/other-notifications-list-empty-state";+ return UserMenuOtherNotificationsListEmptyState;}get renderDismissConfirmation() {diff --git a/frontend/discourse/app/components/user-menu/replies-notifications-list.js b/frontend/discourse/app/components/user-menu/replies-notifications-list.jsindex 49b791f3175..36b8926f4c8 100644--- a/frontend/discourse/app/components/user-menu/replies-notifications-list.js+++ b/frontend/discourse/app/components/user-menu/replies-notifications-list.js@@ -1,4 +1,5 @@import UserMenuNotificationsList from "discourse/components/user-menu/notifications-list";+import UserMenuNotificationsListEmptyState from "discourse/components/user-menu/notifications-list-empty-state";export default class UserMenuRepliesNotificationsList extends UserMenuNotificationsList {get dismissTypes() {@@ -10,6 +11,6 @@ export default class UserMenuRepliesNotificationsList extends UserMenuNotificati}get emptyStateComponent() {- return "user-menu/notifications-list-empty-state";+ return UserMenuNotificationsListEmptyState;}}diff --git a/plugins/chat/assets/javascripts/discourse/components/user-menu/chat-notifications-list.js b/plugins/chat/assets/javascripts/discourse/components/user-menu/chat-notifications-list.jsindex 5190e0d579e..dccc834d859 100644--- a/plugins/chat/assets/javascripts/discourse/components/user-menu/chat-notifications-list.js+++ b/plugins/chat/assets/javascripts/discourse/components/user-menu/chat-notifications-list.js@@ -1,4 +1,5 @@import UserMenuNotificationsList from "discourse/components/user-menu/notifications-list";+import UserMenuChatNotificationsListEmptyState from "discourse/plugins/chat/discourse/components/user-menu/chat-notifications-list-empty-state";export default class UserMenuChatNotificationsList extends UserMenuNotificationsList {get dismissTypes() {@@ -6,6 +7,6 @@ export default class UserMenuChatNotificationsList extends UserMenuNotifications}get emptyStateComponent() {- return "user-menu/chat-notifications-list-empty-state";+ return UserMenuChatNotificationsListEmptyState;}}