From 74df53e7c8d81abf77ca67ab7432a5a8bfc8e4f6 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sat, 20 Apr 2024 11:37:22 +0200 Subject: [PATCH] ValidUser: fix not working for @unknown-user mentions --- src/plugins/validUser/index.tsx | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/plugins/validUser/index.tsx b/src/plugins/validUser/index.tsx index dafa7bc98..d3decd941 100644 --- a/src/plugins/validUser/index.tsx +++ b/src/plugins/validUser/index.tsx @@ -115,15 +115,24 @@ export default definePlugin({ authors: [Devs.Ven], tags: ["MentionCacheFix"], - patches: [{ - find: 'className:"mention"', - replacement: { - // mention = { react: function (data, parse, props) { if (data.userId == null) return RoleMention() else return UserMention() - match: /react(?=\(\i,\i,\i\).{0,50}return null==.{0,70}\?\(0,\i\.jsx\)\((\i\.\i),.+?jsx\)\((\i\.\i),\{className:"mention")/, - // react: (...args) => OurWrapper(RoleMention, UserMention, ...args), originalReact: theirFunc - replace: "react:(...args)=>$self.renderMention($1,$2,...args),originalReact" + patches: [ + { + find: 'className:"mention"', + replacement: { + // mention = { react: function (data, parse, props) { if (data.userId == null) return RoleMention() else return UserMention() + match: /react(?=\(\i,\i,\i\).{0,50}return null==.{0,70}\?\(0,\i\.jsx\)\((\i\.\i),.+?jsx\)\((\i\.\i),\{className:"mention")/, + // react: (...args) => OurWrapper(RoleMention, UserMention, ...args), originalReact: theirFunc + replace: "react:(...args)=>$self.renderMention($1,$2,...args),originalReact" + } + }, + { + find: "unknownUserMentionPlaceholder:", + replacement: { + match: /unknownUserMentionPlaceholder:/, + replace: "$&false&&" + } } - }], + ], renderMention(RoleMention, UserMention, data, parse, props) { return (