Update ReadAllNotificationsButton.plugin.js

This commit is contained in:
Mirco Wittrien 2024-09-05 14:25:31 +02:00
parent e98d43d087
commit 510346eeea
1 changed files with 123 additions and 111 deletions

View File

@ -2,7 +2,7 @@
* @name ReadAllNotificationsButton
* @author DevilBro
* @authorId 278543574059057154
* @version 1.7.7
* @version 1.7.8
* @description Adds a Clear Button to the Server List and the Mentions Popout
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -279,8 +279,20 @@ module.exports = (_ => {
}
processGuildsBar (e) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "UnreadDMs"});
const process = returnValue => {
let [children, index] = BDFDB.ReactUtils.findParent(returnValue, {name: "UnreadDMs"});
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(ReadAllButtonComponent, {}));
};
let themeWrapper = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: n => n && n.props && typeof n.props.children == "function"});
if (themeWrapper) {
let childrenRender = themeWrapper.props.children;
themeWrapper.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
process(children);
return children;
}, "Error in Children Render of Theme Wrapper!", this);
}
else process(e.returnvalue);
}
processInboxHeader (e) {