Skip to content

Commit

Permalink
WhoReacted: fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Vendicated committed Jul 17, 2024
1 parent 67632ec commit 80b493d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/plugins/messageLinkEmbeds/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ async function fetchMessage(channelID: string, messageID: string) {
if (!msg) return;

const message: Message = MessageStore.getMessages(msg.channel_id).receiveMessage(msg).get(msg.id);
if (!message) return;

messageCache.set(message.id, {
message,
Expand Down
32 changes: 17 additions & 15 deletions src/plugins/whoReacted/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,23 @@ function fetchReactions(msg: Message, emoji: ReactionEmoji, type: number) {
},
oldFormErrors: true
})
.then(res => FluxDispatcher.dispatch({
type: "MESSAGE_REACTION_ADD_USERS",
channelId: msg.channel_id,
messageId: msg.id,
users: res.body,
emoji,
reactionType: type
}))
.then(res => {
for (const user of res.body) {
FluxDispatcher.dispatch({
type: "USER_UPDATE",
user
});
}

FluxDispatcher.dispatch({
type: "MESSAGE_REACTION_ADD_USERS",
channelId: msg.channel_id,
messageId: msg.id,
users: res.body,
emoji,
reactionType: type
});
})
.catch(console.error)
.finally(() => sleep(250));
}
Expand Down Expand Up @@ -148,13 +157,6 @@ export default definePlugin({
const reactions = getReactionsWithQueue(message, emoji, type);
const users = Object.values(reactions).filter(Boolean) as User[];

for (const user of users) {
FluxDispatcher.dispatch({
type: "USER_UPDATE",
user
});
}

return (
<div
style={{ marginLeft: "0.5em", transform: "scale(0.9)" }}
Expand Down

0 comments on commit 80b493d

Please sign in to comment.