aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/PatchHelper.tsx3
-rw-r--r--src/plugins/typingIndicator.tsx13
-rw-r--r--src/utils/patches.ts4
-rw-r--r--src/utils/types.ts4
4 files changed, 14 insertions, 10 deletions
diff --git a/src/components/PatchHelper.tsx b/src/components/PatchHelper.tsx
index 6524528..f1fe22c 100644
--- a/src/components/PatchHelper.tsx
+++ b/src/components/PatchHelper.tsx
@@ -19,7 +19,8 @@
import { debounce } from "@utils/debounce";
import { Margins } from "@utils/margins";
import { makeCodeblock } from "@utils/misc";
-import { canonicalizeMatch, canonicalizeReplace, ReplaceFn } from "@utils/patches";
+import { canonicalizeMatch, canonicalizeReplace } from "@utils/patches";
+import { ReplaceFn } from "@utils/types";
import { search } from "@webpack";
import { Button, Clipboard, Forms, Parser, React, Switch, Text, TextInput } from "@webpack/common";
diff --git a/src/plugins/typingIndicator.tsx b/src/plugins/typingIndicator.tsx
index 9af09bc..4b0d162 100644
--- a/src/plugins/typingIndicator.tsx
+++ b/src/plugins/typingIndicator.tsx
@@ -22,7 +22,7 @@ import { Devs } from "@utils/constants";
import { LazyComponent } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types";
import { find, findLazy, findStoreLazy } from "@webpack";
-import { ChannelStore, GuildMemberStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
+import { ChannelStore, GuildMemberStore, RelationshipStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
import { buildSeveralUsers } from "./typingTweaks";
@@ -57,9 +57,9 @@ function TypingIndicator({ channelId }: { channelId: string; }) {
if (isChannelMuted) return null;
}
- delete typingUsers[UserStore.getCurrentUser().id];
+ const myId = UserStore.getCurrentUser().id;
- const typingUsersArray = Object.keys(typingUsers);
+ const typingUsersArray = Object.keys(typingUsers).filter(id => id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers));
let tooltipText: string;
switch (typingUsersArray.length) {
@@ -108,13 +108,18 @@ const settings = definePluginSettings({
type: OptionType.BOOLEAN,
description: "Whether to show the typing indicator for muted channels.",
default: false
+ },
+ includeBlockedUsers: {
+ type: OptionType.BOOLEAN,
+ description: "Whether to show the typing indicator for blocked users.",
+ default: false
}
});
export default definePlugin({
name: "TypingIndicator",
description: "Adds an indicator if someone is typing on a channel.",
- authors: [Devs.Nuckyz],
+ authors: [Devs.Nuckyz, Devs.obscurity],
settings,
patches: [
diff --git a/src/utils/patches.ts b/src/utils/patches.ts
index 0f83d40..c30f7b1 100644
--- a/src/utils/patches.ts
+++ b/src/utils/patches.ts
@@ -16,9 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import { PatchReplacement } from "./types";
-
-export type ReplaceFn = (match: string, ...groups: string[]) => string;
+import { PatchReplacement, ReplaceFn } from "./types";
export function canonicalizeMatch(match: RegExp | string) {
if (typeof match === "string") return match;
diff --git a/src/utils/types.ts b/src/utils/types.ts
index 76a3d74..54c9674 100644
--- a/src/utils/types.ts
+++ b/src/utils/types.ts
@@ -19,13 +19,13 @@
import { Command } from "@api/Commands";
import { Promisable } from "type-fest";
-import type { ReplaceFn } from "./patches";
-
// exists to export default definePlugin({...})
export default function definePlugin<P extends PluginDef>(p: P & Record<string, any>) {
return p;
}
+export type ReplaceFn = (match: string, ...groups: string[]) => string;
+
export interface PatchReplacement {
match: string | RegExp;
replace: string | ReplaceFn;