TypingIndicator: setting to disable for current channel (#2043)
This commit is contained in:
parent
2cf52d0775
commit
b32959126e
1 changed files with 11 additions and 2 deletions
|
@ -21,7 +21,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
|
|||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findExportedComponentLazy, findStoreLazy } from "@webpack";
|
||||
import { ChannelStore, GuildMemberStore, i18n, RelationshipStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
|
||||
import { ChannelStore, GuildMemberStore, i18n, RelationshipStore, SelectedChannelStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
|
||||
|
||||
import { buildSeveralUsers } from "../typingTweaks";
|
||||
|
||||
|
@ -47,7 +47,7 @@ function TypingIndicator({ channelId }: { channelId: string; }) {
|
|||
return oldKeys.length === currentKeys.length && currentKeys.every(key => old[key] != null);
|
||||
}
|
||||
);
|
||||
|
||||
const currentChannelId: string = useStateFromStores([SelectedChannelStore], () => SelectedChannelStore.getChannelId());
|
||||
const guildId = ChannelStore.getChannel(channelId).guild_id;
|
||||
|
||||
if (!settings.store.includeMutedChannels) {
|
||||
|
@ -55,6 +55,10 @@ function TypingIndicator({ channelId }: { channelId: string; }) {
|
|||
if (isChannelMuted) return null;
|
||||
}
|
||||
|
||||
if (!settings.store.includeCurrentChannel) {
|
||||
if (currentChannelId === channelId) return null;
|
||||
}
|
||||
|
||||
const myId = UserStore.getCurrentUser()?.id;
|
||||
|
||||
const typingUsersArray = Object.keys(typingUsers).filter(id => id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers));
|
||||
|
@ -101,6 +105,11 @@ function TypingIndicator({ channelId }: { channelId: string; }) {
|
|||
}
|
||||
|
||||
const settings = definePluginSettings({
|
||||
includeCurrentChannel: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Whether to show the typing indicator for the currently selected channel",
|
||||
default: true
|
||||
},
|
||||
includeMutedChannels: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Whether to show the typing indicator for muted channels.",
|
||||
|
|
Loading…
Reference in a new issue