QuickReply: skip blocked messages if NoBlockedMessages enabled (#2476)

This commit is contained in:
PWall 2024-05-21 02:52:43 +02:00 committed by GitHub
parent 44d708129b
commit 0751722add
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,6 +24,7 @@ import { ChannelStore, FluxDispatcher as Dispatcher, MessageStore, PermissionsBi
import { Message } from "discord-types/general"; import { Message } from "discord-types/general";
const Kangaroo = findByPropsLazy("jumpToMessage"); const Kangaroo = findByPropsLazy("jumpToMessage");
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
const isMac = navigator.platform.includes("Mac"); // bruh const isMac = navigator.platform.includes("Mac"); // bruh
let replyIdx = -1; let replyIdx = -1;
@ -139,6 +140,10 @@ function getNextMessage(isUp: boolean, isReply: boolean) {
messages = messages.filter(m => m.author.id === meId); messages = messages.filter(m => m.author.id === meId);
} }
if (Vencord.Plugins.isPluginEnabled("NoBlockedMessages")) {
messages = messages.filter(m => !RelationshipStore.isBlocked(m.author.id));
}
const mutate = (i: number) => isUp const mutate = (i: number) => isUp
? Math.min(messages.length - 1, i + 1) ? Math.min(messages.length - 1, i + 1)
: Math.max(-1, i - 1); : Math.max(-1, i - 1);