ValidUser: fix not working for @unknown-user mentions

This commit is contained in:
Vendicated 2024-04-20 11:37:22 +02:00
parent 87ef214810
commit 74df53e7c8
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18

View file

@ -115,15 +115,24 @@ export default definePlugin({
authors: [Devs.Ven], authors: [Devs.Ven],
tags: ["MentionCacheFix"], tags: ["MentionCacheFix"],
patches: [{ patches: [
find: 'className:"mention"', {
replacement: { find: 'className:"mention"',
// mention = { react: function (data, parse, props) { if (data.userId == null) return RoleMention() else return UserMention() replacement: {
match: /react(?=\(\i,\i,\i\).{0,50}return null==.{0,70}\?\(0,\i\.jsx\)\((\i\.\i),.+?jsx\)\((\i\.\i),\{className:"mention")/, // mention = { react: function (data, parse, props) { if (data.userId == null) return RoleMention() else return UserMention()
// react: (...args) => OurWrapper(RoleMention, UserMention, ...args), originalReact: theirFunc match: /react(?=\(\i,\i,\i\).{0,50}return null==.{0,70}\?\(0,\i\.jsx\)\((\i\.\i),.+?jsx\)\((\i\.\i),\{className:"mention")/,
replace: "react:(...args)=>$self.renderMention($1,$2,...args),originalReact" // 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) { renderMention(RoleMention, UserMention, data, parse, props) {
return ( return (