summary refs log tree commit diff
path: root/api/src/routes
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-31 17:55:23 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-31 17:55:23 +0200
commit5d820f35347fe328605edfbcce9e26dcbf75af07 (patch)
tree05b8c49c2f93134c5f3adcd01d6bf1f8228db8ae /api/src/routes
parent:sparkles: typeorm error handler (diff)
downloadserver-5d820f35347fe328605edfbcce9e26dcbf75af07.tar.xz
:bug: fix message sending
Diffstat (limited to 'api/src/routes')
-rw-r--r--api/src/routes/channels/#channel_id/messages/#message_id/index.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/api/src/routes/channels/#channel_id/messages/#message_id/index.ts b/api/src/routes/channels/#channel_id/messages/#message_id/index.ts
index 32478763..b9d46c4f 100644
--- a/api/src/routes/channels/#channel_id/messages/#message_id/index.ts
+++ b/api/src/routes/channels/#channel_id/messages/#message_id/index.ts
@@ -20,7 +20,9 @@ router.patch("/", check(MessageCreateSchema), async (req: Request, res: Response
 		body = { flags: body.flags }; // admins can only suppress embeds of other messages
 	}
 
-	const opts = await handleMessage({
+	const new_message = await handleMessage({
+		// TODO: should be message_reference overridable?
+		// @ts-ignore
 		message_reference: message.message_reference,
 		...body,
 		author_id: message.author_id,
@@ -28,10 +30,9 @@ router.patch("/", check(MessageCreateSchema), async (req: Request, res: Response
 		id: message_id,
 		edited_timestamp: new Date()
 	});
-	message.assign(opts);
 
 	await Promise.all([
-		message.save(),
+		new_message.save(),
 		await emitEvent({
 			event: "MESSAGE_UPDATE",
 			channel_id,