summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-08-04 13:28:48 +0200
committerRory& <root@rory.gay>2026-08-04 13:28:48 +0200
commitdcfd91035e3da42abf5f32d8d86a35219225b3d4 (patch)
treee2e904ebdd5bef109bb62a11477c3c8f1ab08176 /src
parentAssert membership, ignore everyone role and limit results of role member-ids ... (diff)
downloadserver-ts-dcfd91035e3da42abf5f32d8d86a35219225b3d4.tar.xz
Assert that requesting user is a member of (group/) DM before allowing them to add members
Diffstat (limited to 'src')
-rw-r--r--src/api/routes/channels/#channel_id/recipients.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/api/routes/channels/#channel_id/recipients.ts b/src/api/routes/channels/#channel_id/recipients.ts

index 72ac12f7f..78cce3c72 100644 --- a/src/api/routes/channels/#channel_id/recipients.ts +++ b/src/api/routes/channels/#channel_id/recipients.ts
@@ -39,6 +39,10 @@ router.put( relations: { recipients: true }, }); + if (!channel.recipients || channel.recipients.length == 0 || channel.recipients.filter((r) => r.user_id == req.user_id).length == 0) { + throw DiscordApiErrors.UNKNOWN_CHANNEL; // TODO: is this the right error + } + if (channel.type !== ChannelType.GROUP_DM) { const recipients = [...new Set([...(channel.recipients?.map((r) => r.user_id) || []), user_id])];