Update RemoveBlockedMessages.plugin.js
This commit is contained in:
parent
96a4446c50
commit
e510033f7b
|
@ -14,12 +14,12 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "RemoveBlockedMessages",
|
||||
"author": "DevilBro",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"description": "Completely removes blocked messages"
|
||||
},
|
||||
"changeLog": {
|
||||
"fixed": {
|
||||
"Update Reactions": "Fixed issue where reaction sometimes wouldn't show up at all"
|
||||
"Update Reactions": "Fixed issue where reaction sometimes wouldn't show up at all, really now"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -275,30 +275,29 @@ module.exports = (_ => {
|
|||
reaction.props.count = cachedReactions[reaction.props.message.id][emojiId].reactions.length;
|
||||
if (reaction.props.count < 1) e.returnvalue.props.children[0][i] = null;
|
||||
}
|
||||
else {
|
||||
else BDFDB.LibraryModules.ReactionUtils.getReactions(reaction.props.message.channel_id, reaction.props.message.id, reaction.props.emoji).then(reactions => {
|
||||
if (!reactions || !reactions.length) return;
|
||||
let someBlocked = false;
|
||||
BDFDB.LibraryModules.ReactionUtils.getReactions(reaction.props.message.channel_id, reaction.props.message.id, reaction.props.emoji).then(reactions => {
|
||||
let filteredReactions = reactions.filter(n => {
|
||||
let isBlocked = n && BDFDB.LibraryModules.FriendUtils.isBlocked(n.id);
|
||||
someBlocked = someBlocked || isBlocked;
|
||||
return !isBlocked;
|
||||
});
|
||||
if (someBlocked) {
|
||||
reaction.props.reactions = filteredReactions;
|
||||
reaction.props.count = reaction.props.reactions.length;
|
||||
BDFDB.TimeUtils.clear(updateTimeout);
|
||||
updateTimeout = BDFDB.TimeUtils.timeout(_ => {
|
||||
BDFDB.ReactUtils.forceUpdate(e.instance);
|
||||
}, 1000);
|
||||
}
|
||||
if (cachedReactions && cachedReactions[reaction.props.message.id]) cachedReactions[reaction.props.message.id][emojiId] = {
|
||||
blocked: someBlocked,
|
||||
relationshipCount: relationshipCount,
|
||||
oldCount: (reaction.props.message.reactions.find(n => n.emoji.name && n.emoji.name == emojiId || n.emoji.id == emojiId) || {}).count || 0,
|
||||
reactions: reaction.props.reactions || reactions
|
||||
};
|
||||
let filteredReactions = reactions.filter(n => {
|
||||
let isBlocked = n && BDFDB.LibraryModules.FriendUtils.isBlocked(n.id);
|
||||
someBlocked = someBlocked || isBlocked;
|
||||
return !isBlocked;
|
||||
});
|
||||
}
|
||||
if (someBlocked) {
|
||||
reaction.props.reactions = filteredReactions;
|
||||
reaction.props.count = reaction.props.reactions.length;
|
||||
BDFDB.TimeUtils.clear(updateTimeout);
|
||||
updateTimeout = BDFDB.TimeUtils.timeout(_ => {
|
||||
BDFDB.ReactUtils.forceUpdate(e.instance);
|
||||
}, 1000);
|
||||
}
|
||||
if (cachedReactions && cachedReactions[reaction.props.message.id]) cachedReactions[reaction.props.message.id][emojiId] = {
|
||||
blocked: someBlocked,
|
||||
relationshipCount: relationshipCount,
|
||||
oldCount: (reaction.props.message.reactions.find(n => n.emoji.name && n.emoji.name == emojiId || n.emoji.id == emojiId) || {}).count || 0,
|
||||
reactions: reaction.props.reactions || reactions
|
||||
};
|
||||
});
|
||||
}
|
||||
if (!e.returnvalue.props.children[0].filter(n => n).length) return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue