diff --git a/src/equicordplugins/customUserColors/index.tsx b/src/equicordplugins/customUserColors/index.tsx index ad7e3567e..f77749e5b 100644 --- a/src/equicordplugins/customUserColors/index.tsx +++ b/src/equicordplugins/customUserColors/index.tsx @@ -62,6 +62,7 @@ const userContextMenuPatch: NavContextMenuPatchCallback = (children, { user }: { }; export function getCustomColorString(userId: string, withHash?: boolean): string | undefined { + if (!userId) return; if (!colors[userId] || !Settings.plugins.CustomUserColors.enabled) return; if (withHash) return `#${colors[userId]}`; return colors[userId]; diff --git a/src/main/utils/extensions.ts b/src/main/utils/extensions.ts index b48eb33d1..9ecfbfe82 100644 --- a/src/main/utils/extensions.ts +++ b/src/main/utils/extensions.ts @@ -79,5 +79,6 @@ export async function installExt(id: string) { .catch(err => console.error(`Failed to extract extension ${id}`, err)); } - session.defaultSession.loadExtension(extDir); + // @ts-expect-error Electron 36 Deprecates session.defaultSession.loadExtension() + session.defaultSession.extensions ? session.defaultSession.extensions.loadExtension(extDir) : session.defaultSession.loadExtension(extDir); } diff --git a/src/plugins/ircColors/index.ts b/src/plugins/ircColors/index.ts index 500302c98..4f71e2286 100644 --- a/src/plugins/ircColors/index.ts +++ b/src/plugins/ircColors/index.ts @@ -109,13 +109,18 @@ export default definePlugin({ const id = context?.user?.id; const colorString = context?.colorString; const color = calculateNameColorForUser(id); - const customColor = id && Settings.plugins.CustomUserColors.enabled ? getCustomColorString(id, true) : null; - if ( - (settings.store.applyColorOnlyInDms && !context?.channel?.isPrivate()) || - (settings.store.applyColorOnlyToUsersWithoutColor && colorString) - ) return customColor ?? colorString; + if (Settings.plugins.CustomUserColors.enabled) { + const customColor = getCustomColorString(id, true); + if (customColor) return customColor; + } - return customColor ?? color; + if (settings.store.applyColorOnlyInDms && !context?.channel?.isPrivate()) { + return colorString; + } + + return (!settings.store.applyColorOnlyToUsersWithoutColor || !colorString) + ? color + : colorString; } }); diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index 7b2d57148..daafc994d 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -165,8 +165,10 @@ export default definePlugin({ getColorString(userId: string, channelOrGuildId: string) { try { - if (Settings.plugins.CustomUserColors.enabled) - return getCustomColorString(userId, true); + if (Settings.plugins.CustomUserColors.enabled) { + const customColor = getCustomColorString(userId, true); + if (customColor) return customColor; + } const guildId = ChannelStore.getChannel(channelOrGuildId)?.guild_id ?? GuildStore.getGuild(channelOrGuildId)?.id; if (guildId == null) return null; diff --git a/src/plugins/typingTweaks/index.tsx b/src/plugins/typingTweaks/index.tsx index d556480a3..7aeb58b2d 100644 --- a/src/plugins/typingTweaks/index.tsx +++ b/src/plugins/typingTweaks/index.tsx @@ -60,10 +60,15 @@ interface Props { guildId: string; } -function typingUserColor(guildId: string, userId: string) { +function typingUserColor(guildId: string, userId: string): string | undefined { if (!settings.store.showRoleColors) return; - const customColor = Settings.plugins.CustomUserColors.enabled ? getCustomColorString(userId, true) : null; - return customColor ?? GuildMemberStore.getMember(guildId, userId)?.colorString; + + if (Settings.plugins.CustomUserColors.enabled) { + const customColor = getCustomColorString(userId, true); + if (customColor) return customColor; + } + + return GuildMemberStore.getMember(guildId, userId)?.colorString; } const TypingUser = ErrorBoundary.wrap(function ({ user, guildId }: Props) {