From 34ab68e5be3e8c00fe75b985b430b7983fcc7145 Mon Sep 17 00:00:00 2001 From: _Lighty_ <49841131+1Lighty@users.noreply.github.com> Date: Wed, 23 Sep 2020 15:26:10 +0200 Subject: [PATCH] URB v1.0.8 --- Plugins/UnreadBadgesRedux/UnreadBadgesRedux.plugin.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Plugins/UnreadBadgesRedux/UnreadBadgesRedux.plugin.js b/Plugins/UnreadBadgesRedux/UnreadBadgesRedux.plugin.js index a831b01..1d592ea 100644 --- a/Plugins/UnreadBadgesRedux/UnreadBadgesRedux.plugin.js +++ b/Plugins/UnreadBadgesRedux/UnreadBadgesRedux.plugin.js @@ -41,7 +41,7 @@ module.exports = (() => { twitter_username: '' } ], - version: '1.0.7', + version: '1.0.8', description: 'Adds a number badge to server icons and channels.', github: 'https://github.com/1Lighty', github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/UnreadBadgesRedux/UnreadBadgesRedux.plugin.js' @@ -50,7 +50,7 @@ module.exports = (() => { { title: 'fixed', type: 'fixed', - items: ['Fixed not working on canary.'] + items: ['Fixed not working on channels.'] } ], defaultConfig: [ @@ -350,10 +350,12 @@ module.exports = (() => { so appending it without slicing first would append it to the components props children array */ - const buttons = ret.props.children.slice(0); + const props = Utilities.findInReactTree(ret, e => Array.isArray(e.children) && e.children.find(e => e && e.type && e.type.displayName === 'ConnectedEditButton')); + if (!props) return; + const buttons = props.children.slice(0); if (!buttons) return; buttons.splice(this.settings.misc.channelsDisplayOnLeft ? 0 : 2, 0, badge); - ret.props.children = buttons; + props.children = buttons; }); ChannelItem.forceUpdateAll(); }