This commit is contained in:
Mirco Wittrien 2022-08-12 13:12:53 +02:00
parent ba58d12f6d
commit 23b535e67f
3 changed files with 14 additions and 19 deletions

View File

@ -2,7 +2,7 @@
* @name RemoveBlockedUsers
* @author DevilBro
* @authorId 278543574059057154
* @version 1.5.1
* @version 1.5.2
* @description Removes blocked Messages/Users
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "RemoveBlockedUsers",
"author": "DevilBro",
"version": "1.5.1",
"version": "1.5.2",
"description": "Removes blocked Messages/Users"
}
};
@ -409,31 +409,26 @@ module.exports = (_ => {
}
for (let i in newRows) if (newRows[i] && newRows[i].type == "GROUP" && newRows[i].count <= 0) newRows[i] = undefined;
const removeEmptyWithin = (array, filter) => {
let reversed = [].concat(array).reverse();
let prefixLength = 0, suffixLength = 0;
for (let i in array) if (array[i] !== undefined) {
prefixLength = parseInt(i);
break;
}
let reversed = [].concat(array).reverse(), suffixLength = 0;
for (let i in reversed) if (reversed[i] !== undefined) {
suffixLength = parseInt(i);
break;
}
return [].concat(new Array(prefixLength), array.filter(filter), new Array(suffixLength))
return [].concat(array.filter(filter), new Array(suffixLength))
};
channelMembers.props.rows = removeEmptyWithin(newRows, n => n);
channelMembers.props.groups = removeEmptyWithin(newGroups, g => g && g.count > 0);
}
}
processPrivateChannelRecipients (e) {
if (this.settings.places.voiceChat && e.instance.props.channel && e.instance.props.channel.isGroupDM()) e.instance.props.channel = new BDFDB.DiscordObjects.Channel(Object.assign({}, e.instance.props.channel, {rawRecipients: e.instance.props.channel.rawRecipients.filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryModules.RelationshipStore.isBlocked(id))}));
}
processMemberListItem (e) {
if (this.settings.places.memberList && e.instance.props.user && BDFDB.LibraryModules.RelationshipStore.isBlocked(e.instance.props.user.id)) return null;
}
processPrivateChannelRecipients (e) {
if (this.settings.places.voiceChat && e.instance.props.channel && e.instance.props.channel.isGroupDM()) e.instance.props.channel = new BDFDB.DiscordObjects.Channel(Object.assign({}, e.instance.props.channel, {rawRecipients: e.instance.props.channel.rawRecipients.filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryModules.RelationshipStore.isBlocked(id))}));
}
processNowPlayingItem (e) {
if (this.settings.places.activity) {
let [children, index] = BDFDB.ReactUtils.findParent(e.instance, {name: "NowPlayingHeader"});

View File

@ -698,7 +698,7 @@ module.exports = (_ => {
let ids = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10);
args[2] = args[2].filter(id => !ids.includes(id));
return topIsVisible(...args) || BDFDB.LibraryModules.UnreadGuildUtils.getMentionCount(args[0]) == 0;
}, "Error in isVisible of Top Bar in Guild List!");
}, "Error in isVisible of Top Bar in Guild List!", this);
}
let bottomBar = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.guildswrapperunreadmentionsbarbottom]]});
if (bottomBar) {
@ -707,7 +707,7 @@ module.exports = (_ => {
let ids = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10);
args[2] = args[2].filter(id => !ids.includes(id));
return bottomIsVisible(...args) || BDFDB.LibraryModules.UnreadGuildUtils.getMentionCount(args[0]) == 0;
}, "Error in isVisible of Bottom Bar in Guild List!");
}, "Error in isVisible of Bottom Bar in Guild List!", this);
}
}
}