SMYN: Support Mention UI and Fix Typing Tweaks Function
This commit is contained in:
parent
48beea4159
commit
ce80cafe61
2 changed files with 19 additions and 9 deletions
|
|
@ -56,7 +56,7 @@ const symbolPattern = /^[\p{S}\p{P}]{1,3}$/iu;
|
|||
const templatePattern = /(?:\{(?:custom|friend|nick|display|user)(?:,\s*(?:custom|friend|nick|display|user))*\})/iu;
|
||||
|
||||
type CustomNicknameData = Record<string, string>;
|
||||
export let customNicknames: CustomNicknameData = {};
|
||||
let customNicknames: CustomNicknameData = {};
|
||||
|
||||
let toCSSCache: Map<string, string | null> | null = null;
|
||||
let toCSSProbe: HTMLDivElement | null = null;
|
||||
|
|
@ -387,6 +387,12 @@ function getTypingMemberListProfilesReactionsVoiceNameElement(props: memberListP
|
|||
return getTypingMemberListProfilesReactionsVoiceName(props)[1];
|
||||
}
|
||||
|
||||
function matchableCustomName(userId: string) {
|
||||
const custom = customNicknames[userId];
|
||||
if (!custom || (settings.store.customNameOnlyInDirectMessages && getCurrentChannel()?.guild_id)) return "";
|
||||
return custom.toLocaleLowerCase();
|
||||
}
|
||||
|
||||
function getActiveNowNameElement({ user, guildId, isHovered }: activeNowNameProps): JSX.Element | string | null {
|
||||
const name = getTypingMemberListProfilesReactionsVoiceNameText({ user, guildId, type: "membersList" });
|
||||
|
||||
|
|
@ -1254,12 +1260,6 @@ const settings = definePluginSettings({
|
|||
},
|
||||
});
|
||||
|
||||
function matchableCustomName(userId: string) {
|
||||
const custom = customNicknames[userId];
|
||||
if (!custom || (settings.store.customNameOnlyInDirectMessages && getCurrentChannel()?.guild_id)) return "";
|
||||
return custom.toLocaleLowerCase();
|
||||
}
|
||||
|
||||
export default definePlugin({
|
||||
name: "ShowMeYourName",
|
||||
description: "Display any permutation of custom nicknames, friend nicknames, server nicknames, display names, and usernames in chat.",
|
||||
|
|
@ -1524,6 +1524,14 @@ export default definePlugin({
|
|||
replace: "$&||$1()($2,$self.matchableCustomName($3.id))"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
// above but in the ui
|
||||
find: "#{intl::COMMANDS_OPTIONAL_COUNT}",
|
||||
replacement: {
|
||||
match: /\i\?\?\i\?\?\i\.\i\.getName\(\i\)/,
|
||||
replace: '$self.getTypingMemberListProfilesReactionsVoiceNameText({user:this.props.user,guildId:this.props.guildId,type:"membersList"})'
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { isPluginEnabled } from "@api/PluginManager";
|
||||
import { definePluginSettings, migratePluginToSettings, Settings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { getCustomColorString } from "@equicordplugins/customUserColors";
|
||||
import { customNicknames } from "@plugins/showMeYourName";
|
||||
import ShowMeYourName from "@plugins/showMeYourName";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import { classNameFactory } from "@utils/css";
|
||||
import { openUserProfile } from "@utils/discord";
|
||||
|
|
@ -105,7 +106,8 @@ const TypingUser = ErrorBoundary.wrap(function TypingUser({ user, guildId }: Typ
|
|||
size="SIZE_16"
|
||||
src={user.getAvatarURL(guildId, 128)} />
|
||||
)}
|
||||
{customNicknames[user.id]
|
||||
{isPluginEnabled(ShowMeYourName.name)
|
||||
&& ShowMeYourName.getTypingMemberListProfilesReactionsVoiceNameText({ user, guildId, type: "typingIndicator" })
|
||||
|| GuildMemberStore.getNick(guildId!, user.id)
|
||||
|| (!guildId && RelationshipStore.getNickname(user.id))
|
||||
|| (user as any).globalName
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue