From 3e5d9cc6c9db32455a8a49ef127d1029609e3b71 Mon Sep 17 00:00:00 2001 From: NoriDev Date: Fri, 20 Oct 2023 05:08:03 +0900 Subject: [PATCH] fix messaging --- packages/backend/src/core/MessagingService.ts | 2 +- packages/backend/src/core/entities/UserEntityService.ts | 2 +- packages/backend/src/server/api/endpoints/messaging/history.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/core/MessagingService.ts b/packages/backend/src/core/MessagingService.ts index cabad96ce7..5891f2c8ea 100644 --- a/packages/backend/src/core/MessagingService.ts +++ b/packages/backend/src/core/MessagingService.ts @@ -294,7 +294,7 @@ export class MessagingService { .where('message.groupId = :groupId', { groupId: groupId }) .andWhere('message.userId != :userId', { userId: userId }) .andWhere('NOT (:userId = ANY(message.reads))', { userId: userId }) - .andWhere('message.createdAt > :joinedAt', { joinedAt: this.idService.parse(joining.id) }) // 自分が加入する前の会話については、未読扱いしない + .andWhere('message.id > :joinedAt', { joinedAt: this.idService.parse(joining.id) }) // 自分が加入する前の会話については、未読扱いしない .getOne().then(x => x != null); if (!unreadExist) { diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index cdee4b9ac7..ad97ffd9d7 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -233,7 +233,7 @@ export class UserEntityService implements OnModuleInit { .where('message.groupId = :groupId', { groupId: j.userGroupId }) .andWhere('message.userId != :userId', { userId: userId }) .andWhere('NOT (:userId = ANY(message.reads))', { userId: userId }) - .andWhere('message.createdAt > :joinedAt', { joinedAt: this.idService.parse(j.id) }) // 自分が加入する前の会話については、未読扱いしない + .andWhere('message.id > :joinedAt', { joinedAt: this.idService.parse(j.id) }) // 自分が加入する前の会話については、未読扱いしない .getOne().then(x => x != null))); const [withUser, withGroups] = await Promise.all([ diff --git a/packages/backend/src/server/api/endpoints/messaging/history.ts b/packages/backend/src/server/api/endpoints/messaging/history.ts index 83e9e0f783..c314ba46c7 100644 --- a/packages/backend/src/server/api/endpoints/messaging/history.ts +++ b/packages/backend/src/server/api/endpoints/messaging/history.ts @@ -73,7 +73,7 @@ export default class extends Endpoint { // eslint- : history.map(m => (m.userId === me.id) ? m.recipientId! : m.userId!); const query = this.messagingMessagesRepository.createQueryBuilder('message') - .orderBy('message.createdAt', 'DESC'); + .orderBy('message.id', 'DESC'); if (ps.group) { query.where('message.groupId IN (:...groups)', { groups: groups });