summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-12-13 02:24:22 +0100
committerRory& <root@rory.gay>2025-12-13 02:24:22 +0100
commite6d22ccc47d6fb5a28dd8e295aa46557f2cc88ad (patch)
treeb4ecd96fb22de6107b0e15525bab7cd24d5ec7e6 /src
parentFix missing group by? (diff)
downloadserver-ts-e6d22ccc47d6fb5a28dd8e295aa46557f2cc88ad.tar.xz
Maybe?>
Diffstat (limited to 'src')
-rw-r--r--src/util/entities/User.ts13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts

index 7b78b428..375aaba4 100644 --- a/src/util/entities/User.ts +++ b/src/util/entities/User.ts
@@ -345,7 +345,6 @@ export class User extends BaseClass { .where("Channel.type = :type", { type: ChannelType.DM }) .andWhere("rcp.user_id IN (:...user_ids)", { user_ids: [this.id, user_id] }) .groupBy("Channel.id") - .addGroupBy("rcp.user_id") .having("COUNT(rcp.user_id) = 2") .getMany(); @@ -363,13 +362,13 @@ export class User extends BaseClass { async getDmChannels() { const qry = await Channel.getRepository() - .createQueryBuilder() - .leftJoinAndSelect("Channel.recipients", "rcp") - .where("Channel.type = :type", { type: ChannelType.DM }) + .createQueryBuilder("channel") + .leftJoinAndSelect("channel.recipients", "rcp") + .where("channel.type = :type", { type: ChannelType.DM }) .andWhere("rcp.user_id = :user_id", { user_id: this.id }) - .groupBy("Channel.id") - .addGroupBy("rcp.user_id") - .having("COUNT(rcp.user_id) = 2") + .groupBy("channel.id") + .addGroupBy("rcp.id") + .having("COUNT(rcp.id) = 2") .getMany(); return qry;