From 4786d4be6b02b38f891f845cac620bff4f68c828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Thom=C3=A9?= Date: Thu, 15 Apr 2021 04:28:19 -0300 Subject: [PATCH 1/3] check if message link is null --- client/components/Message/Attachments/Item.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/Message/Attachments/Item.tsx b/client/components/Message/Attachments/Item.tsx index 4def65873e1dd..8042aec6a19d5 100644 --- a/client/components/Message/Attachments/Item.tsx +++ b/client/components/Message/Attachments/Item.tsx @@ -7,7 +7,7 @@ import { isFileAttachment, FileAttachment } from './Files'; import { QuoteAttachment, QuoteAttachmentProps } from './QuoteAttachment'; const isQuoteAttachment = (attachment: AttachmentProps): attachment is QuoteAttachmentProps => - 'message_link' in attachment; + 'message_link' in attachment && attachment.message_link !== null; const Item: FC<{ attachment: AttachmentProps; file?: FileProp }> = ({ attachment, file }) => { if (isFileAttachment(attachment)) { From cf9ff26683e505e77b54efe8f29df1ce41b2e775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Thom=C3=A9?= Date: Tue, 20 Apr 2021 17:04:27 -0300 Subject: [PATCH 2/3] check if user is room owner --- server/services/team/service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/services/team/service.ts b/server/services/team/service.ts index 1952adb45fdc3..657624f0cf4ac 100644 --- a/server/services/team/service.ts +++ b/server/services/team/service.ts @@ -323,6 +323,10 @@ export class TeamService extends ServiceClass implements ITeamService { throw new Error('room-already-on-team'); } + if (room.u._id !== uid) { + throw new Error('invalid-user'); + } + room.teamId = teamId; } From 4d2e3bc980ac5266e2def2692850e223e5691451 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Wed, 21 Apr 2021 01:31:26 -0300 Subject: [PATCH 3/3] Prevent error with GENERAL --- server/services/team/service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/services/team/service.ts b/server/services/team/service.ts index 657624f0cf4ac..c5500a8a2cd30 100644 --- a/server/services/team/service.ts +++ b/server/services/team/service.ts @@ -323,7 +323,7 @@ export class TeamService extends ServiceClass implements ITeamService { throw new Error('room-already-on-team'); } - if (room.u._id !== uid) { + if (room.u?._id !== uid) { throw new Error('invalid-user'); }