From 0d297112181347d994114a406c1c926978ec34c7 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Wed, 9 Feb 2022 19:53:51 +0100 Subject: [PATCH] Update 0BDFDB.plugin.js --- Library/0BDFDB.plugin.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index 05bfaf2f49..763201776d 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -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) {