summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-02-23 06:53:08 +0100
committerRory& <root@rory.gay>2026-02-23 06:53:08 +0100
commit2775d5aa0bd2f0a9ca085cee2ba976b51e3084cd (patch)
treeb9cf22bab4f388acdb0d77cf0998600034db412a /src/api
parentDiscovery fixes, nix updates (diff)
downloadserver-ts-2775d5aa0bd2f0a9ca085cee2ba976b51e3084cd.tar.xz
Faster pings
Diffstat (limited to 'src/api')
-rw-r--r--src/api/util/handlers/Message.ts8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts

index d19b73ad..f78827ed 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts
@@ -51,7 +51,7 @@ import { } from "@spacebar/util"; import { HTTPError } from "lambert-server"; import { In, Or, Equal, IsNull } from "typeorm"; -import { ChannelType, Embed, EmbedType, MessageCreateAttachment, MessageCreateCloudAttachment, MessageCreateSchema, MessageType, Reaction } from "@spacebar/schemas"; +import { ChannelType, Embed, EmbedType, MessageCreateAttachment, MessageCreateCloudAttachment, MessageCreateSchema, MessageType, Reaction, ReadStateType } from "@spacebar/schemas"; const allow_empty = false; // TODO: check webhook, application, system author, stickers // TODO: embed gifs/videos/images @@ -444,7 +444,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> { await fillInMissingIDs((await Member.find({ where: { guild_id: channel.guild_id } })).map(({ id }) => id)); } const repository = ReadState.getRepository(); - const condition = { channel_id: channel.id }; + const condition = { channel_id: channel.id, type: ReadStateType.CHANNEL }; await repository.update({ ...condition, mention_count: IsNull() }, { mention_count: 0 }); await repository.increment(condition, "mention_count", 1); } else { @@ -467,11 +467,9 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> { } if (users.size) { const repository = ReadState.getRepository(); - const condition = { user_id: Or(...[...users].map((id) => Equal(id))), channel_id: channel.id }; + const condition = { user_id: Or(...[...users].map((id) => Equal(id))), channel_id: channel.id, read_state_type: ReadStateType.CHANNEL }; await fillInMissingIDs([...users]); - - await repository.update({ ...condition, mention_count: IsNull() }, { mention_count: 0 }); await repository.increment(condition, "mention_count", 1); } }