refac: $user

This commit is contained in:
Timothy Jaeryang Baek
2025-03-31 20:32:12 -07:00
parent 1b7c125f00
commit e0ec2cdeb0
27 changed files with 57 additions and 57 deletions
+4 -4
View File
@@ -132,7 +132,7 @@
if (
(message?.reactions ?? [])
.find((reaction) => reaction.name === name)
?.user_ids?.includes($user.id) ??
?.user_ids?.includes($user?.id) ??
false
) {
messages = messages.map((m) => {
@@ -140,7 +140,7 @@
const reaction = m.reactions.find((reaction) => reaction.name === name);
if (reaction) {
reaction.user_ids = reaction.user_ids.filter((id) => id !== $user.id);
reaction.user_ids = reaction.user_ids.filter((id) => id !== $user?.id);
reaction.count = reaction.user_ids.length;
if (reaction.count === 0) {
@@ -167,12 +167,12 @@
const reaction = m.reactions.find((reaction) => reaction.name === name);
if (reaction) {
reaction.user_ids.push($user.id);
reaction.user_ids.push($user?.id);
reaction.count = reaction.user_ids.length;
} else {
m.reactions.push({
name: name,
user_ids: [$user.id],
user_ids: [$user?.id],
count: 1
});
}