Update RemoveBlockedUsers.plugin.js

This commit is contained in:
Mirco Wittrien 2024-01-02 18:40:39 +01:00
parent a09294a1c1
commit 833c5f33e5
1 changed files with 19 additions and 1 deletions

View File

@ -2,7 +2,7 @@
* @name RemoveBlockedUsers * @name RemoveBlockedUsers
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.6.7 * @version 1.6.8
* @description Removes blocked Messages/Users * @description Removes blocked Messages/Users
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -66,6 +66,9 @@ module.exports = (_ => {
return class RemoveBlockedUsers extends Plugin { return class RemoveBlockedUsers extends Plugin {
onLoad () { onLoad () {
this.defaults = { this.defaults = {
general: {
hideBlocked: {value: false, description: "Hide 'Blocked' Tab in Friends List"}
},
notifications: { notifications: {
messages: {value: true, description: "Messages Notifications"}, messages: {value: true, description: "Messages Notifications"},
voiceChat: {value: true, description: "Voice Chat Notifications"}, voiceChat: {value: true, description: "Voice Chat Notifications"},
@ -101,6 +104,7 @@ module.exports = (_ => {
"ReactionsModalUsers", "ReactionsModalUsers",
"RTCConnectionVoiceUsers", "RTCConnectionVoiceUsers",
"SearchResults", "SearchResults",
"TabBar",
"UserSummaryItem", "UserSummaryItem",
"VoiceUsers" "VoiceUsers"
], ],
@ -209,6 +213,14 @@ module.exports = (_ => {
collapseStates: collapseStates, collapseStates: collapseStates,
children: _ => { children: _ => {
let settingsItems = []; let settingsItems = [];
for (let key in this.defaults.general) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: this,
keys: ["general", key],
label: this.defaults.general[key].description,
value: this.settings.general[key]
}));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, { settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
title: "Disable", title: "Disable",
@ -523,6 +535,12 @@ module.exports = (_ => {
} }
} }
processTabBar (e) {
if (this.settings.general.hideBlocked && e.instance.props.children && e.instance.props.children.some(c => c && c.props && c.props.id == BDFDB.DiscordConstants.FriendsSections.ADD_FRIEND)) {
e.instance.props.children = e.instance.props.children.filter(c => c && c.props.id != BDFDB.DiscordConstants.FriendsSections.BLOCKED);
}
}
getGroupName (channelId) { getGroupName (channelId) {
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId); let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
if (channel.name) return channel.name; if (channel.name) return channel.name;