summary refs log tree commit diff
path: root/api/src
diff options
context:
space:
mode:
authorAlTech98 <altech123159@gmail.com>2021-09-17 18:29:02 +0200
committerAlTech98 <altech123159@gmail.com>2021-09-17 18:29:02 +0200
commit50ab5e7d490413388a8365a82af43c40b252beec (patch)
tree099b631552a9e72b273d4924db4806703c76a027 /api/src
parentMerge branch 'fosscord:master' into fix-dm (diff)
downloadserver-50ab5e7d490413388a8365a82af43c40b252beec.tar.xz
Fix icon, owner_id change and channel deletion for group DMs
Diffstat (limited to 'api/src')
-rw-r--r--api/src/routes/channels/#channel_id/index.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/api/src/routes/channels/#channel_id/index.ts b/api/src/routes/channels/#channel_id/index.ts

index e836622b..70dd3994 100644 --- a/api/src/routes/channels/#channel_id/index.ts +++ b/api/src/routes/channels/#channel_id/index.ts
@@ -1,6 +1,6 @@ import { Channel, ChannelDeleteEvent, ChannelPermissionOverwriteType, ChannelService, ChannelType, ChannelUpdateEvent, emitEvent, Recipient } from "@fosscord/util"; import { Request, Response, Router } from "express"; -import { route } from "@fosscord/api"; +import { handleFile, route } from "@fosscord/api"; const router: Router = Router(); // TODO: delete channel @@ -44,9 +44,10 @@ export interface ChannelModifySchema { /** * @maxLength 100 */ - name: string; - type: ChannelType; + name?: string; + type?: ChannelType; topic?: string; + icon?: string | null; bitrate?: number; user_limit?: number; rate_limit_per_user?: number; @@ -67,6 +68,7 @@ export interface ChannelModifySchema { router.patch("/", route({ body: "ChannelModifySchema", permission: "MANAGE_CHANNELS" }), async (req: Request, res: Response) => { var payload = req.body as ChannelModifySchema; const { channel_id } = req.params; + if (payload.icon) payload.icon = await handleFile(`/channel-icons/${channel_id}`, payload.icon); const channel = await Channel.findOneOrFail({ id: channel_id }); channel.assign(payload);