Update EditUsers.plugin.js

This commit is contained in:
Mirco Wittrien 2020-11-11 00:45:03 +01:00
parent beba94fa9c
commit bcb73ce3f3
1 changed files with 12 additions and 5 deletions

View File

@ -13,12 +13,12 @@ module.exports = (_ => {
"info": {
"name": "EditUsers",
"author": "DevilBro",
"version": "4.0.1",
"version": "4.0.2",
"description": "Allow you to change the icon, name, tag and color of users"
},
"changeLog": {
"improved": {
"Inline Replies": "Works already for the yet to be released inline replies"
"fixed": {
"Direct Message Icons": "Gets changed again"
}
}
};
@ -811,8 +811,15 @@ module.exports = (_ => {
let recipientId = e.instance.props.channel.getRecipientId();
let tooltip = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ListItemTooltip"});
if (tooltip) tooltip.props.text = this.getUserData(recipientId).username;
let avatar = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "NavItem"});
if (avatar) avatar.props.icon = this.getUserAvatar(recipientId);
let avatar = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: c => c && c.props && !isNaN(parseInt(c.props.id))});
if (avatar && typeof avatar.props.children == "function") {
let childrenRender = avatar.props.children;
avatar.props.children = (...args) => {
let renderedChildren = childrenRender(...args);
if (renderedChildren && renderedChildren.props) renderedChildren.props.icon = this.getUserAvatar(recipientId);
return renderedChildren;
};
}
}
}