Revert "Update RemoveBlockedMessages.plugin.js"

This reverts commit 33ba5b2cdb.
This commit is contained in:
Mirco Wittrien 2020-10-15 18:52:21 +02:00
parent 33ba5b2cdb
commit 4fba2df0d4
1 changed files with 3 additions and 19 deletions

View File

@ -5,12 +5,12 @@ module.exports = (_ => {
"info": {
"name": "RemoveBlockedMessages",
"author": "DevilBro",
"version": "1.0.9",
"version": "1.0.8",
"description": "Completely removes blocked messages."
},
"changeLog": {
"fixed": {
"Hide Users": "Also hides user icons in the voice channel overview & in the autocomplete menu",
"Hide Users": "Also hides user icons in the voice channel overview",
"Role Group Count": "Fixes role group count for hidden banned users"
}
}
@ -58,9 +58,7 @@ module.exports = (_ => {
this.patchedModules = {
before: {
ChannelMembers: "render",
PrivateChannelRecipients: "default",
VoiceUsers: "render",
PrivateChannel: "render",
PrivateChannelCallParticipants: "render",
ChannelCall: "render",
UserSummaryItem: "render"
@ -71,8 +69,6 @@ module.exports = (_ => {
VoiceUser: "render"
}
};
this.patchPriority = 10;
}
onStart() {
@ -100,10 +96,6 @@ module.exports = (_ => {
}
}});
if (BDFDB.LibraryModules.AutocompleteOptions && BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS) BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS.MENTIONS, "queryResults", {after: e => {
if (settings.removeUsers) e.returnValue.users = e.returnValue.users.filter(n => !n.user || !BDFDB.LibraryModules.FriendUtils.isBlocked(n.user.id));
}});
this.forceUpdateAll();
}
@ -154,7 +146,7 @@ module.exports = (_ => {
let messages = messagesIns.props.messages;
messagesIns.props.messages = new BDFDB.DiscordObjects.Messages(messages);
for (let key in messages) messagesIns.props.messages[key] = messages[key];
messagesIns.props.messages._array = [].concat(messagesIns.props.messages._array.filter(n => !n.author || !BDFDB.LibraryModules.FriendUtils.isBlocked(n.author.id)));
messagesIns.props.messages._array = [].concat(messagesIns.props.messages._array.filter(n => n.author && !BDFDB.LibraryModules.FriendUtils.isBlocked(n.author.id)));
if (messagesIns.props.oldestUnreadMessageId && messagesIns.props.messages._array.every(n => n.id != messagesIns.props.oldestUnreadMessageId)) messagesIns.props.oldestUnreadMessageId = null;
}
}
@ -189,10 +181,6 @@ module.exports = (_ => {
}
}
processPrivateChannelRecipients (e) {
if (settings.removeUsers && 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.FriendUtils.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryModules.FriendUtils.isBlocked(id))}));
}
processMemberListItem (e) {
if (settings.removeUsers && e.instance.props.user && BDFDB.LibraryModules.FriendUtils.isBlocked(e.instance.props.user.id)) return null;
}
@ -205,10 +193,6 @@ module.exports = (_ => {
if (settings.removeUsers && e.instance.props.user && BDFDB.LibraryModules.FriendUtils.isBlocked(e.instance.props.user.id)) return null;
}
processPrivateChannel (e) {
if (settings.removeUsers && 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.FriendUtils.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryModules.FriendUtils.isBlocked(id))}));
}
processPrivateChannelCallParticipants (e) {
if (settings.removeUsers && BDFDB.ArrayUtils.is(e.instance.props.participants)) e.instance.props.participants = [].concat(e.instance.props.participants).filter(n => !n.user || !BDFDB.LibraryModules.FriendUtils.isBlocked(n.user.id));
}