From 49a1bc6ed0ee6291c2372c336d5e3797cd864c2a Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Thu, 29 Aug 2019 23:23:06 +0200 Subject: [PATCH] bug fix --- Plugins/EditChannels/EditChannels.plugin.js | 13 ++++++++----- Plugins/EditUsers/EditUsers.plugin.js | 21 ++++++++++++--------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Plugins/EditChannels/EditChannels.plugin.js b/Plugins/EditChannels/EditChannels.plugin.js index ead490881e..c50dc59699 100644 --- a/Plugins/EditChannels/EditChannels.plugin.js +++ b/Plugins/EditChannels/EditChannels.plugin.js @@ -3,7 +3,7 @@ class EditChannels { getName () {return "EditChannels";} - getVersion () {return "3.9.9";} + getVersion () {return "4.0.0";} getAuthor () {return "DevilBro";} @@ -11,7 +11,7 @@ class EditChannels { initConstructor () { this.changelog = { - "improved":[["Color Gradients","You can now use color gradients to edit channels"]] + "fixed":[["EditUsers bug","Fixed a bug that occured when EditUsers is enabled"]] }; this.labels = {}; @@ -401,9 +401,12 @@ class EditChannels { else { if (channel.type == 1) channel = this.UserUtils.getUser(channel.recipients[0]) || channel; if (channelname.EditChannelsChangeObserver && typeof channelname.EditChannelsChangeObserver.disconnect == "function") channelname.EditChannelsChangeObserver.disconnect(); - channelname.style.removeProperty("color"); - channelname.style.removeProperty("background"); - BDFDB.setInnerText(channelname, channel.name || channel.username); + if (BDFDB.isPluginEnabled("EditUsers")) bdplugins.EditUsers.plugin.changeName(channel, channelname); + else { + channelname.style.removeProperty("color"); + channelname.style.removeProperty("background"); + BDFDB.setInnerText(channelname, channel.name || channel.username); + } } } } diff --git a/Plugins/EditUsers/EditUsers.plugin.js b/Plugins/EditUsers/EditUsers.plugin.js index 7c3137144c..c7c9d8db89 100644 --- a/Plugins/EditUsers/EditUsers.plugin.js +++ b/Plugins/EditUsers/EditUsers.plugin.js @@ -3,7 +3,7 @@ class EditUsers { getName () {return "EditUsers";} - getVersion () {return "3.5.2";} + getVersion () {return "3.5.3";} getAuthor () {return "DevilBro";} @@ -11,7 +11,7 @@ class EditUsers { initConstructor () { this.changelog = { - "fixed":[["DM Header","Now works properly in DM Headers"]] + "fixed":[["EditChannels bug","Fixed a bug that occured when EditChannels is enabled"]] }; this.labels = {}; @@ -711,16 +711,19 @@ class EditUsers { processHeaderBar (instance, wrapper) { let channel_id = BDFDB.getReactValue(instance, "props.channelId") || BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.channelId"); if (channel_id) { - let username = wrapper.querySelector(BDFDB.dotCN.channelheaderheaderbartitle); - if (username) { + let channelname = wrapper.querySelector(BDFDB.dotCN.channelheaderheaderbartitle); + if (channelname) { let channel = this.ChannelUtils.getChannel(channel_id); if (channel) { - if (channel.type == 1) this.changeName(this.UserUtils.getUser(channel.recipients[0]), username); + if (channel.type == 1) this.changeName(this.UserUtils.getUser(channel.recipients[0]), channelname); else { - if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect(); - username.style.removeProperty("color"); - username.style.removeProperty("background"); - BDFDB.setInnerText(username, channel.name); + if (channelname.EditUsersChangeObserver && typeof channelname.EditUsersChangeObserver.disconnect == "function") channelname.EditUsersChangeObserver.disconnect(); + if (BDFDB.isPluginEnabled("EditChannels")) bdplugins.EditChannels.plugin.changeChannel(channel, channelname); + else { + channelname.style.removeProperty("color"); + channelname.style.removeProperty("background"); + BDFDB.setInnerText(channelname, channel.name); + } } } }