summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorMathMan05 <mathmanrm@gmail.com>2026-02-03 19:37:21 -0600
committerRory& <root@rory.gay>2026-02-04 03:25:48 +0100
commiteaa2be281f59ca1aeeee35a09493008146d1a9d3 (patch)
tree1a75f0d28adaae88910bc747a9d477f1fc6b5cef /src/api
parentunscrew up (diff)
downloadserver-ts-eaa2be281f59ca1aeeee35a09493008146d1a9d3.tar.xz
some fixes
Diffstat (limited to 'src/api')
-rw-r--r--src/api/routes/channels/#channel_id/messages/#message_id/threads.ts3
-rw-r--r--src/api/routes/channels/#channel_id/messages/index.ts10
-rw-r--r--src/api/routes/channels/#channel_id/threads.ts7
-rw-r--r--src/api/util/handlers/Message.ts2
4 files changed, 3 insertions, 19 deletions
diff --git a/src/api/routes/channels/#channel_id/messages/#message_id/threads.ts b/src/api/routes/channels/#channel_id/messages/#message_id/threads.ts

index 48834402..e68a02b3 100644 --- a/src/api/routes/channels/#channel_id/messages/#message_id/threads.ts +++ b/src/api/routes/channels/#channel_id/messages/#message_id/threads.ts
@@ -50,7 +50,6 @@ router.post( where: { id: channel_id }, }); const user = await User.findOneOrFail({ where: { id: req.user_id } }); - const recipient = Recipient.create({ channel_id: message.id, user }); const thread = await Channel.createChannel( { @@ -78,8 +77,6 @@ router.post( { skipPermissionCheck: true, keepId: true, skipEventEmit: true }, ); - recipient.save(); - message.thread = thread; message.flags ||= 1 << 5; await sendMessage({ diff --git a/src/api/routes/channels/#channel_id/messages/index.ts b/src/api/routes/channels/#channel_id/messages/index.ts
index 54ef7f3e..d89d39c6 100644 --- a/src/api/routes/channels/#channel_id/messages/index.ts +++ b/src/api/routes/channels/#channel_id/messages/index.ts
@@ -533,16 +533,6 @@ router.post( // no await as it shouldnt block the message send function and silently catch error postHandleMessage(message).catch((e) => console.error("[Message] post-message handler failed", e)); - if (channel.type === ChannelType.GUILD_PUBLIC_THREAD && channel.recipients && !channel.recipients.find((_) => _.user.id === req.user_id)) { - const rec = Recipient.create({ - channel_id: channel.id, - user_id: req.user_id, - }); - channel.recipients.push(rec); - rec.save().then(() => { - channel.save(); - }); - } return res.json( message.withSignedAttachments( diff --git a/src/api/routes/channels/#channel_id/threads.ts b/src/api/routes/channels/#channel_id/threads.ts
index 0a320c87..79392fe6 100644 --- a/src/api/routes/channels/#channel_id/threads.ts +++ b/src/api/routes/channels/#channel_id/threads.ts
@@ -17,8 +17,8 @@ */ import { handleMessage, postHandleMessage, route, sendMessage } from "@spacebar/api"; -import { Message, Channel, emitEvent, User, MessageUpdateEvent, Recipient, uploadFile, Attachment, Member, ReadState, MessageCreateEvent } from "@spacebar/util"; -import { MessageThreadCreationSchema, ChannelType, MessageType, ThreadCreationSchema, MessageCreateAttachment, MessageCreateCloudAttachment } from "@spacebar/schemas"; +import { Channel, emitEvent, User, uploadFile, Attachment, Member, ReadState, MessageCreateEvent } from "@spacebar/util"; +import { ChannelType, MessageType, ThreadCreationSchema, MessageCreateAttachment, MessageCreateCloudAttachment } from "@spacebar/schemas"; import { Request, Response, Router } from "express"; import { messageUpload } from "./messages"; @@ -81,9 +81,6 @@ router.post( void 0, { skipPermissionCheck: true, keepId: true, skipEventEmit: true }, ); - const recipient = Recipient.create({ channel_id: channel.id, user }); - - await recipient.save(); await Promise.all([ emitEvent({ diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts
index bf1f5e96..f7957369 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts
@@ -243,7 +243,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> { if (opts.message_reference.type != 1) { if (opts.message_reference.guild_id !== channel.guild_id) throw new HTTPError("You can only reference messages from this guild"); - if (opts.message_reference.channel_id !== opts.channel_id && opts.type !== MessageType.THREAD_STARTER_MESSAGE) + if (opts.message_reference.channel_id !== opts.channel_id && opts.type !== MessageType.THREAD_STARTER_MESSAGE && opts.type !== MessageType.THREAD_CREATED) throw new HTTPError("You can only reference messages from this channel"); }