summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/routes/channels/#channel_id/messages/index.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/api/routes/channels/#channel_id/messages/index.ts b/src/api/routes/channels/#channel_id/messages/index.ts
index 747701db..e0c91b8a 100644
--- a/src/api/routes/channels/#channel_id/messages/index.ts
+++ b/src/api/routes/channels/#channel_id/messages/index.ts
@@ -201,6 +201,19 @@ router.post(
 			);
 		}
 
+		if (body.nonce) {
+			const existing = await Message.findOne({
+				where: {
+					nonce: body.nonce,
+					channel_id: channel.id,
+					author_id: req.user_id
+				}
+			});
+			if (existing) {
+				return res.json(existing);
+			}
+		}
+
 		const files = (req.files as Express.Multer.File[]) ?? [];
 		for (var currFile of files) {
 			try {