diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-08 04:27:28 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-09 23:28:27 +0200 |
commit | d52d9c62fc30e31e2c01bf6b63f9aedebdde216f (patch) | |
tree | e0f7fd130aeeecb9964e1f359eea6b4e124de7da /util/src/entities/Channel.ts | |
parent | Clean dependencies (diff) | |
download | server-d52d9c62fc30e31e2c01bf6b63f9aedebdde216f.tar.xz |
Bunch of fixes and improvements, everything appears to work now
Diffstat (limited to 'util/src/entities/Channel.ts')
-rw-r--r-- | util/src/entities/Channel.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts index 5ccb43ce..a7ca647b 100644 --- a/util/src/entities/Channel.ts +++ b/util/src/entities/Channel.ts @@ -222,7 +222,7 @@ export class Channel extends BaseClass { }; await Promise.all([ - new Channel(channel).save(), + Object.assign(new Channel(),channel).save(), !opts?.skipEventEmit ? emitEvent({ event: "CHANNEL_CREATE", @@ -263,7 +263,8 @@ export class Channel extends BaseClass { if (containsAll(re, channelRecipients)) { if (channel == null) { channel = ur.channel; - await ur.assign({ closed: false }).save(); + ur = Object.assign(ur, { closed: false }); + await ur.save(); } } } @@ -272,7 +273,7 @@ export class Channel extends BaseClass { if (channel == null) { name = trimSpecial(name); - channel = await new Channel({ + channel = await (Object.assign(new Channel(), { name, type, owner_id: type === ChannelType.DM ? undefined : null, // 1:1 DMs are ownerless in fosscord-server @@ -280,9 +281,9 @@ export class Channel extends BaseClass { last_message_id: null, recipients: channelRecipients.map( (x) => - new Recipient({ user_id: x, closed: !(type === ChannelType.GROUP_DM || x === creator_user_id) }) + Object.assign(new Recipient(), { user_id: x, closed: !(type === ChannelType.GROUP_DM || x === creator_user_id) }) ), - }).save(); + }) as Channel).save(); } const channel_dto = await DmChannelDTO.from(channel); |