mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 20:52:42 +01:00
🐛 fix message reactions
This commit is contained in:
parent
fc7fc0b7f7
commit
2f7182ca3d
@ -124,7 +124,7 @@ router.put("/:emoji/:user_id", route({ permission: "READ_MESSAGE_HISTORY" }), as
|
||||
already_added.count++;
|
||||
} else message.reactions.push({ count: 1, emoji, user_ids: [req.user_id] });
|
||||
|
||||
await Message.update({ id: message_id, channel_id }, message);
|
||||
await message.save();
|
||||
|
||||
const member = channel.guild_id && (await Member.findOneOrFail({ id: req.user_id }));
|
||||
|
||||
@ -165,7 +165,7 @@ router.delete("/:emoji/:user_id", route({}), async (req: Request, res: Response)
|
||||
|
||||
if (already_added.count <= 0) message.reactions.remove(already_added);
|
||||
|
||||
await Message.update({ id: message_id, channel_id }, message);
|
||||
await message.save();
|
||||
|
||||
await emitEvent({
|
||||
event: "MESSAGE_REACTION_REMOVE",
|
||||
|
@ -74,9 +74,7 @@ export class Message extends BaseClass {
|
||||
author_id: string;
|
||||
|
||||
@JoinColumn({ name: "author_id", referencedColumnName: "id" })
|
||||
@ManyToOne(() => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@ManyToOne(() => User)
|
||||
author?: User;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@ -120,7 +118,7 @@ export class Message extends BaseClass {
|
||||
mention_everyone?: boolean;
|
||||
|
||||
@JoinTable({ name: "message_user_mentions" })
|
||||
@ManyToMany(() => User, { orphanedRowAction: "delete", onDelete: "CASCADE", cascade: true })
|
||||
@ManyToMany(() => User)
|
||||
mentions: User[];
|
||||
|
||||
@JoinTable({ name: "message_role_mentions" })
|
||||
|
Loading…
Reference in New Issue
Block a user