aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/pronoundb/index.ts2
-rw-r--r--src/plugins/pronoundb/pronoundbUtils.ts16
2 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/pronoundb/index.ts b/src/plugins/pronoundb/index.ts
index c996551..8605869 100644
--- a/src/plugins/pronoundb/index.ts
+++ b/src/plugins/pronoundb/index.ts
@@ -69,7 +69,7 @@ export default definePlugin({
replacement: [
{
match: /getGlobalName\(\i\);(?<=displayProfile.{0,200})/,
- replace: "$&const [vcPronounce,vcPronounSource]=$self.useProfilePronouns(arguments[0].user.id);if(arguments[0].displayProfile&&vcPronounce)arguments[0].displayProfile.pronouns=vcPronounce;"
+ replace: "$&const [vcPronounce,vcPronounSource]=$self.useProfilePronouns(arguments[0].user.id,true);if(arguments[0].displayProfile&&vcPronounce)arguments[0].displayProfile.pronouns=vcPronounce;"
},
PRONOUN_TOOLTIP_PATCH
]
diff --git a/src/plugins/pronoundb/pronoundbUtils.ts b/src/plugins/pronoundb/pronoundbUtils.ts
index 07e79a7..8bde10e 100644
--- a/src/plugins/pronoundb/pronoundbUtils.ts
+++ b/src/plugins/pronoundb/pronoundbUtils.ts
@@ -58,16 +58,20 @@ const bulkFetch = debounce(async () => {
}
});
-function getDiscordPronouns(id: string) {
+function getDiscordPronouns(id: string, useGlobalProfile: boolean = false) {
+ const globalPronouns = UserProfileStore.getUserProfile(id)?.pronouns;
+
+ if (useGlobalProfile) return globalPronouns;
+
return (
UserProfileStore.getGuildMemberProfile(id, getCurrentChannel()?.guild_id)?.pronouns
- || UserProfileStore.getUserProfile(id)?.pronouns
+ || globalPronouns
);
}
-export function useFormattedPronouns(id: string): PronounsWithSource {
+export function useFormattedPronouns(id: string, useGlobalProfile: boolean = false): PronounsWithSource {
// Discord is so stupid you can put tons of newlines in pronouns
- const discordPronouns = getDiscordPronouns(id)?.trim().replace(NewLineRe, " ");
+ const discordPronouns = getDiscordPronouns(id, useGlobalProfile)?.trim().replace(NewLineRe, " ");
const [result] = useAwaiter(() => fetchPronouns(id), {
fallbackValue: getCachedPronouns(id),
@@ -83,8 +87,8 @@ export function useFormattedPronouns(id: string): PronounsWithSource {
return [discordPronouns, "Discord"];
}
-export function useProfilePronouns(id: string): PronounsWithSource {
- const pronouns = useFormattedPronouns(id);
+export function useProfilePronouns(id: string, useGlobalProfile: boolean = false): PronounsWithSource {
+ const pronouns = useFormattedPronouns(id, useGlobalProfile);
if (!settings.store.showInProfile) return EmptyPronouns;
if (!settings.store.showSelf && id === UserStore.getCurrentUser().id) return EmptyPronouns;