mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-28 00:54:16 +00:00
thread stuff ig
This commit is contained in:
@@ -41,6 +41,7 @@ import {
|
||||
stringGlobToRegexp,
|
||||
uploadFile,
|
||||
User,
|
||||
Recipient,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
@@ -59,6 +60,7 @@ import {
|
||||
Reaction,
|
||||
ReadStateType,
|
||||
RelationshipType,
|
||||
ChannelType,
|
||||
} from "@spacebar/schemas";
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
@@ -472,6 +474,16 @@ 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(
|
||||
|
||||
Reference in New Issue
Block a user