summary refs log tree commit diff
diff options
context:
space:
mode:
authorRealMANI <96433859+ImAaronFR@users.noreply.github.com>2022-08-11 23:50:08 +0430
committerErkin Alp Güney <erkinalp9035@gmail.com>2022-08-12 16:52:17 +0300
commitc2295a0498628538e93fcbf8fbf164b57ffeb47e (patch)
treef307bd70c7050caa1717bfe54d4faa9196577a45
parentInvalidate tokens on password change (diff)
downloadserver-c2295a0498628538e93fcbf8fbf164b57ffeb47e.tar.xz
Update index.ts
Adding member field to message gateway
-rw-r--r--api/src/routes/channels/#channel_id/messages/index.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts
index 2fce704b..2ce7f7b3 100644
--- a/api/src/routes/channels/#channel_id/messages/index.ts
+++ b/api/src/routes/channels/#channel_id/messages/index.ts
@@ -245,8 +245,16 @@ router.post(
 			);
 		}
 	
-		//Fix for the client bug
-		delete message.member
+	    //Defining member fields
+		var member = await Member.findOneOrFail({ where: { id: req.user_id }, relations: ["roles"] });
+        member.roles = member.roles.filter((role) => {
+			return role.id !== role.guild_id;
+		}).map((role) => {
+			return role.id;
+		});
+		message.member = member;
+		delete message.member.last_message_id;
+		delete message.member.index;
 		
 		await Promise.all([
 			message.save(),