mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 12:08:12 -05:00
DEV: Deprecate Site.mobileView/desktopView during initialization (#34122)
This commit introduces deprecation warnings for accessing Site.mobileView or Site.desktopView during application initialization to prevent layout-related errors and improve code reliability. The changes include: * Added deprecation warnings for Site.mobileView and Site.desktopView access during the initialization phase. * Updated multiple plugins and components to avoid these deprecated calls during startup. * Refactored initialization logic across discourse-ai, discourse-chat, discourse-calendar, discourse-reactions, discourse-assign, discourse-subscriptions, and discourse-user-notes plugins * Improved error prevention by discouraging early access to view-dependent properties before the application is fully initialized * Enhanced code maintainability by establishing clearer boundaries between initialization and runtime phases This deprecation helps prevent subtle bugs that can occur when components try to determine the view type before the application context is properly established, leading to more robust plugin initialization patterns.
This commit is contained in:
@@ -21,7 +21,7 @@ const message = {
|
||||
|
||||
acceptance("Discourse Chat - Channel Reactions", function (needs) {
|
||||
needs.user({ has_chat_enabled: true });
|
||||
needs.settings({ chat_enabled: true });
|
||||
needs.settings({ chat_enabled: true, enable_emoji: true });
|
||||
|
||||
needs.hooks.beforeEach(function () {
|
||||
pretender.get("/chat/api/me/channels", () =>
|
||||
|
||||
@@ -19,7 +19,11 @@ const GROUP_NAME = "group1";
|
||||
|
||||
acceptance("Discourse Chat - Composer", function (needs) {
|
||||
needs.user({ has_chat_enabled: true });
|
||||
needs.settings({ chat_enabled: true, enable_rich_text_paste: true });
|
||||
needs.settings({
|
||||
chat_enabled: true,
|
||||
enable_rich_text_paste: true,
|
||||
enable_emoji: true,
|
||||
});
|
||||
needs.pretender((server, helper) => {
|
||||
baseChatPretenders(server, helper);
|
||||
chatChannelPretender(server, helper);
|
||||
@@ -70,7 +74,10 @@ acceptance("Discourse Chat - Composer", function (needs) {
|
||||
let sendAttempt = 0;
|
||||
acceptance("Discourse Chat - Composer - unreliable network", function (needs) {
|
||||
needs.user({ id: 1, has_chat_enabled: true });
|
||||
needs.settings({ chat_enabled: true });
|
||||
needs.settings({
|
||||
chat_enabled: true,
|
||||
enable_emoji: true,
|
||||
});
|
||||
needs.pretender((server, helper) => {
|
||||
chatChannelPretender(server, helper);
|
||||
server.get("/chat/:id/messages.json", () =>
|
||||
|
||||
@@ -12,6 +12,7 @@ acceptance("Discourse Chat - Chat live pane collapse", function (needs) {
|
||||
|
||||
needs.settings({
|
||||
chat_enabled: true,
|
||||
enable_emoji: true,
|
||||
});
|
||||
|
||||
needs.pretender((server, helper) => {
|
||||
|
||||
@@ -13,6 +13,7 @@ acceptance(
|
||||
needs.settings({
|
||||
chat_enabled: true,
|
||||
navigation_menu: "legacy",
|
||||
enable_emoji: true,
|
||||
});
|
||||
|
||||
needs.pretender((server, helper) => {
|
||||
|
||||
@@ -23,7 +23,10 @@ acceptance("Chat | Hashtag CSS Generator", function (needs) {
|
||||
name: "category3",
|
||||
};
|
||||
|
||||
needs.settings({ chat_enabled: true });
|
||||
needs.settings({
|
||||
chat_enabled: true,
|
||||
enable_emoji: true,
|
||||
});
|
||||
needs.user({
|
||||
has_chat_enabled: true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user