summary refs log tree commit diff
path: root/src/api/routes/channels
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/routes/channels')
-rw-r--r--src/api/routes/channels/#channel_id/followers.ts2
-rw-r--r--src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts2
-rw-r--r--src/api/routes/channels/#channel_id/messages/index.ts27
-rw-r--r--src/api/routes/channels/#channel_id/recipients.ts4
4 files changed, 20 insertions, 15 deletions
diff --git a/src/api/routes/channels/#channel_id/followers.ts b/src/api/routes/channels/#channel_id/followers.ts
index c06db61b..d91f4b84 100644
--- a/src/api/routes/channels/#channel_id/followers.ts
+++ b/src/api/routes/channels/#channel_id/followers.ts
@@ -1,6 +1,6 @@
 import { Router } from "express";
 const router: Router = Router();
-// TODO:
+// TODO: implement route
 
 export default router;
 
diff --git a/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts b/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts
index fbbc65f0..5cdb2ba1 100644
--- a/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts
+++ b/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts
@@ -4,7 +4,7 @@ import { Request, Response, Router } from "express";
 const router = Router();
 
 router.post("/", route({ permission: "MANAGE_MESSAGES" }), (req: Request, res: Response) => {
-	// TODO:
+	// TODO: implement route
 	res.json({
 		id: "",
 		type: 0,
diff --git a/src/api/routes/channels/#channel_id/messages/index.ts b/src/api/routes/channels/#channel_id/messages/index.ts
index d542ea0f..00008ed4 100644
--- a/src/api/routes/channels/#channel_id/messages/index.ts
+++ b/src/api/routes/channels/#channel_id/messages/index.ts
@@ -12,12 +12,10 @@ import {
 	Message,
 	MessageCreateEvent,
 	MessageCreateSchema,
-	Snowflake,
-	uploadFile,
-	Member,
-	MessageCreateSchema,
 	PluginEventHandler,
-	PreMessageEventArgs
+	PreMessageEventArgs,
+	Snowflake,
+	uploadFile
 } from "@fosscord/util";
 import { Request, Response, Router } from "express";
 import multer from "multer";
@@ -210,8 +208,8 @@ router.post(
 				})
 			);
 		}
-	
-	    //Defining member fields
+
+		//Defining member fields
 		var member = await Member.findOneOrFail({ where: { id: req.user_id }, relations: ["roles", "user"] });
 		// TODO: This doesn't work either
 		// member.roles = member.roles.filter((role) => {
@@ -224,10 +222,17 @@ router.post(
 		// delete message.member.last_message_id;
 		// delete message.member.index;
 
-		let blocks = (await PluginEventHandler.preMessageEvent({
-			message
-		} as PreMessageEventArgs)).filter(x=>x.cancel);
-		if(blocks.length > 0) throw new HTTPError("Message denied.", 400, blocks.filter(x=>x.blockReason).map(x=>x.blockReason));
+		let blocks = (
+			await PluginEventHandler.preMessageEvent({
+				message
+			} as PreMessageEventArgs)
+		).filter((x) => x.cancel);
+		if (blocks.length > 0)
+			throw new HTTPError(
+				"Message denied.",
+				400,
+				blocks.filter((x) => x.blockReason).map((x) => x.blockReason)
+			);
 
 		await Promise.all([
 			message.save(),
diff --git a/src/api/routes/channels/#channel_id/recipients.ts b/src/api/routes/channels/#channel_id/recipients.ts
index 276a0eda..fc6b6b4f 100644
--- a/src/api/routes/channels/#channel_id/recipients.ts
+++ b/src/api/routes/channels/#channel_id/recipients.ts
@@ -26,7 +26,7 @@ router.put("/:user_id", route({}), async (req: Request, res: Response) => {
 		return res.status(201).json(new_channel);
 	} else {
 		if (channel.recipients!.map((r) => r.user_id).includes(user_id)) {
-			throw DiscordApiErrors.INVALID_RECIPIENT; //TODO is this the right error?
+			throw DiscordApiErrors.INVALID_RECIPIENT; //TODO: is this the right error?
 		}
 
 		channel.recipients!.push(OrmUtils.mergeDeep(new Recipient(), { channel_id, user_id: user_id }));
@@ -57,7 +57,7 @@ router.delete("/:user_id", route({}), async (req: Request, res: Response) => {
 		throw DiscordApiErrors.MISSING_PERMISSIONS;
 
 	if (!channel.recipients!.map((r) => r.user_id).includes(user_id)) {
-		throw DiscordApiErrors.INVALID_RECIPIENT; //TODO is this the right error?
+		throw DiscordApiErrors.INVALID_RECIPIENT; //TODO: is this the right error?
 	}
 
 	await Channel.removeRecipientFromChannel(channel, user_id);