From 1460d956d90877547bb1a9164ccad58f43c984bb Mon Sep 17 00:00:00 2001 From: 1024x2 <2pow11@gmail.com> Date: Thu, 13 Jun 2024 01:00:35 +0100 Subject: [PATCH 3/6] Experiments: Re-add staging banner (it's funny) --- src/plugins/experiments/index.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx index 9cb22521..6374c8ac 100644 --- a/src/plugins/experiments/index.tsx +++ b/src/plugins/experiments/index.tsx @@ -21,16 +21,24 @@ import { disableStyle, enableStyle } from "@api/Styles"; import ErrorBoundary from "@components/ErrorBoundary"; import { ErrorCard } from "@components/ErrorCard"; import { Devs } from "@utils/constants"; +import { Logger } from "@utils/Logger"; import { Margins } from "@utils/margins"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy } from "@webpack"; -import { Forms, React } from "@webpack/common"; +import { Forms, React, UserStore } from "@webpack/common"; +import { User } from "discord-types/general"; import hideBugReport from "./hideBugReport.css?managed"; const KbdStyles = findByPropsLazy("key", "removeBuildOverride"); const settings = definePluginSettings({ + forceStagingBanner: { + description: "Whether to force Staging banner under user area.", + type: OptionType.BOOLEAN, + default: false, + restartNeeded: true + }, toolbarDevMenu: { type: OptionType.BOOLEAN, description: "Change the Help (?) toolbar button (top right in chat) to Discord's developer menu", @@ -91,6 +99,14 @@ export default definePlugin({ match: /!\(\i\.isDM\(\)\|\|\i\.isThread\(\)\)/, replace: "true", } + }, + { + find: ".Messages.DEV_NOTICE_STAGING", + predicate: () => settings.store.forceStagingBanner, + replacement: { + match: /window\.GLOBAL_ENV\.RELEASE_CHANNEL/, + replace: "\"staging\"" + } } ], -- 2.45.2