aboutsummaryrefslogtreecommitdiffstats
path: root/0003-Experiments-Re-add-staging-banner.patch
blob: 7294be6ed626c216c97ab816efb421070645e0c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From 728c86eb4d6f3d2c96c1a354a947436dd64d4c8a Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Thu, 13 Jun 2024 01:00:35 +0100
Subject: [PATCH 3/8] 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 33c32b1a..2992807e 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", "combo");
 
 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: "false",
             }
+        },
+        {
+            find: ".Messages.DEV_NOTICE_STAGING",
+            predicate: () => settings.store.forceStagingBanner,
+            replacement: {
+                match: /window\.GLOBAL_ENV\.RELEASE_CHANNEL/,
+                replace: "\"staging\""
+            }
         }
     ],
 
-- 
2.45.2