diff --git a/src/equicordplugins/messagePeek/index.tsx b/src/equicordplugins/messagePeek/index.tsx index 1276700b8..9e28bca9c 100644 --- a/src/equicordplugins/messagePeek/index.tsx +++ b/src/equicordplugins/messagePeek/index.tsx @@ -16,8 +16,8 @@ import { classes } from "@utils/misc"; import definePlugin from "@utils/types"; import { Activity, ApplicationStream, Channel, Message, OnlineStatus, User } from "@vencord/discord-types"; import { MessageFlags } from "@vencord/discord-types/enums"; -import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy, findCssClassesLazy, findExportedComponentLazy, findLazy } from "@webpack"; -import { ChannelStore, MessageStore, Parser, RelationshipStore, SnowflakeUtils, UserStore, useStateFromStores } from "@webpack/common"; +import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy, findCssClassesLazy, findExportedComponentLazy } from "@webpack"; +import { ChannelStore, ExperimentStore, MessageStore, Parser, RelationshipStore, SnowflakeUtils, UserStore, useStateFromStores } from "@webpack/common"; const cl = classNameFactory("vc-message-peek-"); @@ -27,7 +27,6 @@ const MessageActions = findByPropsLazy("fetchMessages", "sendMessage"); const hasRelevantActivity: (props: ActivityCheckProps) => boolean = findByCodeLazy(".OFFLINE||", ".INVISIBLE)return!1"); const ActivityText: React.ComponentType = findComponentByCodeLazy("hasQuest:", "hideEmoji:"); -const FavoritesServerExperiment = findLazy(m => m?.definition?.id === "2021-09_favorites_server"); const ONE_HOUR_MS = 60 * 60 * 1000; @@ -216,7 +215,7 @@ function Timestamp({ channel }: { channel: Channel; }) { if (!lastMessage) return null; const timestamp = SnowflakeUtils.extractTimestamp(lastMessage.id); - const className = FavoritesServerExperiment.getCurrentConfig().favoritesEnabled ? cl("timestamp-favorites") : cl("timestamp"); + const className = ExperimentStore.getUserExperimentBucket("2021-09_favorites_server") >= 1 ? cl("timestamp-favorites") : cl("timestamp"); return {formatRelativeTime(timestamp)}; } diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx index e80e1b433..5c865d6b5 100644 --- a/src/plugins/experiments/index.tsx +++ b/src/plugins/experiments/index.tsx @@ -91,7 +91,7 @@ export default definePlugin({ { find: "useCanFavoriteChannel", replacement: { - match: /\i\.isDM\(\)\|\|\i\.isThread\(\)/, + match: /(?<=\i\.id\)\),\i=)\i\.isThread\(\)/, replace: "false", } }, diff --git a/src/webpack/common/stores.ts b/src/webpack/common/stores.ts index 2baaab5ec..9ef29c889 100644 --- a/src/webpack/common/stores.ts +++ b/src/webpack/common/stores.ts @@ -83,6 +83,7 @@ export let ApplicationCommandIndexStore: t.ApplicationCommandIndexStore; export let EditMessageStore: t.EditMessageStore; export let QuestStore: t.QuestStore; export let PendingReplyStore: GenericStore; +export let ExperimentStore: GenericStore; /** * @see jsdoc of {@link t.useStateFromStores} @@ -137,6 +138,7 @@ waitForStore("PopoutWindowStore", m => PopoutWindowStore = m); waitForStore("ApplicationCommandIndexStore", m => ApplicationCommandIndexStore = m); waitForStore("EditMessageStore", m => EditMessageStore = m); waitForStore("PendingReplyStore", m => PendingReplyStore = m); +waitForStore("ExperimentStore", m => ExperimentStore = m); waitForStore("QuestStore", m => QuestStore = m); waitForStore("ThemeStore", m => { ThemeStore = m;