fix patch modifying the user object

This commit is contained in:
sadan 2024-07-15 13:18:26 -04:00
parent 85e3fa4cc5
commit b4e4085382
No known key found for this signature in database

View file

@ -383,13 +383,11 @@ interface HangStatus {
} }
} }
const vcHangStatusContextPatch: NavContextMenuPatchCallback =(children, props: { const vcHangStatusContextPatch: NavContextMenuPatchCallback =(children, props: {
user: { hangStatusActivity?: HangStatus
HangStatus?: HangStatus
}
}) => { }) => {
if(props.user.HangStatus?.emoji?.id){ if(props.hangStatusActivity?.emoji?.id){
const e = props.user.HangStatus.emoji as Emoji; const e = props.hangStatusActivity.emoji as Emoji;
e.isAnimated = props.user.HangStatus.emoji.animated ?? false; e.isAnimated = props.hangStatusActivity.emoji.animated ?? false;
children.push(buildMenuItem("Emoji", () => { children.push(buildMenuItem("Emoji", () => {
return e; return e;
})); }));
@ -409,12 +407,11 @@ export default definePlugin({
patches: [ patches: [
// needed to pass the HangStatus to the context menu // needed to pass the HangStatus to the context menu
{ {
find: "renderPrioritySpeaker", find: "canWatchStream",
replacement: { replacement: {
match: /(handleContextMenu".*?)(let)/, match: /Menu".*?\.\.\.\i,/,
replace: "$1this.props.user.HangStatus=this.props.hangStatusActivity;$2" replace: "$&hangStatusActivity:this.props.hangStatusActivity,"
} }
}, }
], ],
}); });