SMYN: Filter modal fix. (#1339)
* Filter modal fix. * Filter modal fix. * [autofix.ci] apply automated fixes * Filter modal fix. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
436e938244
commit
99c4535b4d
1 changed files with 22 additions and 5 deletions
|
|
@ -16,7 +16,7 @@ import { Heading } from "@components/Heading";
|
|||
import ircColors from "@plugins/ircColors";
|
||||
import mentionAvatars from "@plugins/mentionAvatars";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import { getCurrentChannel } from "@utils/discord";
|
||||
import { getCurrentChannel, getCurrentGuild } from "@utils/discord";
|
||||
import { classNameFactory } from "@utils/index";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { GuildMember, Message, RenderModalProps, User } from "@vencord/discord-types";
|
||||
|
|
@ -385,7 +385,7 @@ interface messageProps {
|
|||
|
||||
interface memberListProfileReactionProps {
|
||||
user: User | null | undefined;
|
||||
type: "typingIndicator" | "membersList" | "profilesPopout" | "profilesTooltip" | "reactionsTooltip" | "reactionsPopout" | "voiceChannel" | "searchAutocomplete";
|
||||
type: "typingIndicator" | "membersList" | "profilesPopout" | "profilesTooltip" | "reactionsTooltip" | "reactionsPopout" | "voiceChannel" | "searchAutocomplete" | "searchAutocompleteDropdown";
|
||||
guildId?: string;
|
||||
tags?: any;
|
||||
isHovered?: boolean;
|
||||
|
|
@ -399,6 +399,14 @@ interface activeNowNameProps {
|
|||
|
||||
type colorStringsType = { primaryColor: string | null, secondaryColor: string | null, tertiaryColor: string | null; } | null | undefined;
|
||||
|
||||
function wrapFilterResults(options: { id: string, label: string; }[]) {
|
||||
return options.map(item => {
|
||||
const name = getTypingMemberListProfilesReactionsVoiceNameText({ user: UserStore.getUser(item.id), guildId: getCurrentGuild()?.id, type: "searchAutocompleteDropdown" });
|
||||
item.label = name ?? item.label;
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
function addCustomNameResults(
|
||||
results: SearchUserResult[],
|
||||
{ currentToken, maxResults = 10, searchContext }: SearchAutocompleteProps
|
||||
|
|
@ -457,7 +465,7 @@ function getTypingMemberListProfilesReactionsVoiceName(
|
|||
const guildId = props.guildId || props.tags?.props?.displayProfile?.guildId || null;
|
||||
const member = guildId && user ? GuildMemberStore.getMember(guildId, user.id) : null;
|
||||
const author = user && member ? { ...user, ...member } : user || member || null;
|
||||
const shouldHookless = ["typingIndicator", "reactionsTooltip", "profilesTooltip"].includes(type);
|
||||
const shouldHookless = ["typingIndicator", "reactionsTooltip", "profilesTooltip", "searchAutocompleteDropdown"].includes(type);
|
||||
return renderUsername(author, null, null, type, "", shouldHookless, !!guildId, undefined, undefined, props.isHovered);
|
||||
}
|
||||
|
||||
|
|
@ -664,7 +672,7 @@ function renderUsername(
|
|||
author: User | GuildMember | null,
|
||||
channelId: string | null,
|
||||
messageId: string | null,
|
||||
type: "messages" | "replies" | "typingIndicator" | "mentions" | "membersList" | "profilesPopout" | "profilesTooltip" | "reactionsTooltip" | "reactionsPopout" | "voiceChannel" | "searchAutocomplete",
|
||||
type: "messages" | "replies" | "typingIndicator" | "mentions" | "membersList" | "profilesPopout" | "profilesTooltip" | "reactionsTooltip" | "reactionsPopout" | "voiceChannel" | "searchAutocomplete" | "searchAutocompleteDropdown",
|
||||
mentionSymbol: string,
|
||||
hookless: boolean,
|
||||
inGuild: boolean,
|
||||
|
|
@ -677,7 +685,7 @@ function renderUsername(
|
|||
const isMention = type === "mentions";
|
||||
const isTyping = type === "typingIndicator";
|
||||
const isMember = type === "membersList";
|
||||
const isAutocomplete = type === "searchAutocomplete";
|
||||
const isAutocomplete = ["searchAutocomplete", "searchAutocompleteDropdown"].includes(type);
|
||||
const isProfile = type === "profilesPopout";
|
||||
const isReactionsPopout = type === "reactionsPopout";
|
||||
const isReactionsTooltip = type === "reactionsTooltip";
|
||||
|
|
@ -1628,6 +1636,14 @@ export default definePlugin({
|
|||
replace: '$1=$self.getTypingMemberListProfilesReactionsVoiceNameText({user:$4,guildId:$3,type:"searchAutocomplete"})??$2'
|
||||
}
|
||||
},
|
||||
{
|
||||
// Replace names in the popup modal search filter suggestions.
|
||||
find: "selectionMode:\"single\",formatOption",
|
||||
replacement: {
|
||||
match: /(?<=trailing:\i}},options:)(\i)(,placeholder)/,
|
||||
replace: "$self.wrapFilterResults($1)$2"
|
||||
}
|
||||
},
|
||||
{
|
||||
// Replace names in the mention autocomplete.
|
||||
find: "#{intl::COMMANDS_OPTIONAL_COUNT}",
|
||||
|
|
@ -1689,4 +1705,5 @@ export default definePlugin({
|
|||
getTypingMemberListProfilesReactionsVoiceNameElement,
|
||||
matchableCustomName,
|
||||
addCustomNameResults,
|
||||
wrapFilterResults,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue