Update 0BDFDB.plugin.js

This commit is contained in:
Mirco Wittrien 2022-02-09 19:53:51 +01:00
parent c2510362de
commit 0d29711218
1 changed files with 12 additions and 7 deletions

View File

@ -3145,15 +3145,19 @@ module.exports = (_ => {
BDFDB.UserUtils.is = function (user) {
return user && user instanceof BDFDB.DiscordObjects.User;
};
var myDataUser = LibraryModules.UserStore && LibraryModules.UserStore.getCurrentUser && LibraryModules.UserStore.getCurrentUser();
if (myDataUser) document.body.setAttribute("data-current-user-id", myDataUser.id);
const myDataUser = LibraryModules.UserStore && LibraryModules.UserStore.getCurrentUser && LibraryModules.UserStore.getCurrentUser();
if (myDataUser && BDFDB.UserUtils._id != myDataUser.id) {
document.body.setAttribute("data-current-user-id", myDataUser.id);
BDFDB.UserUtils._id = myDataUser.id;
}
BDFDB.UserUtils.me = new Proxy(myDataUser || {}, {
get: function (list, item) {
if (!myDataUser) {
myDataUser = LibraryModules.UserStore && LibraryModules.UserStore.getCurrentUser && LibraryModules.UserStore.getCurrentUser();
if (myDataUser) document.body.setAttribute("data-current-user-id", myDataUser.id);
const user = LibraryModules.UserStore && LibraryModules.UserStore.getCurrentUser && LibraryModules.UserStore.getCurrentUser();
if (user && BDFDB.UserUtils._id != user.id) {
document.body.setAttribute("data-current-user-id", user.id);
BDFDB.UserUtils._id = user.id;
}
return myDataUser ? myDataUser[item] : null;
return user ? user[item] : null;
}
});
@ -8150,7 +8154,8 @@ module.exports = (_ => {
const user = BDFDB.ReactUtils.findValue(e.instance, "user");
if (!user) return;
const wrapper = e.node.querySelector(BDFDB.dotCNC.userpopout + BDFDB.dotCN.userprofile) || e.node;
InternalBDFDB._processAvatarMount(user, e.node.querySelector(BDFDB.dotCN.avatarwrapper), wrapper);
const avatar = e.node.querySelector(BDFDB.dotCN.avatarwrapper);
if (avatar) InternalBDFDB._processAvatarMount(user, e.instance.props.section == BDFDB.DiscordConstants.AnalyticsSections.PROFILE_POPOUT ? avatar.parentElement : avatar, wrapper);
InternalBDFDB._processUserInfoNode(user, wrapper);
};
InternalBDFDB.processPeopleListItem = function (e) {