1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-11 13:18:54 +09:00

fix messaging

This commit is contained in:
NoriDev 2023-10-20 05:08:03 +09:00
parent 6a57810123
commit 3e5d9cc6c9
3 changed files with 3 additions and 3 deletions

View File

@ -294,7 +294,7 @@ export class MessagingService {
.where('message.groupId = :groupId', { groupId: groupId }) .where('message.groupId = :groupId', { groupId: groupId })
.andWhere('message.userId != :userId', { userId: userId }) .andWhere('message.userId != :userId', { userId: userId })
.andWhere('NOT (:userId = ANY(message.reads))', { 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); .getOne().then(x => x != null);
if (!unreadExist) { if (!unreadExist) {

View File

@ -233,7 +233,7 @@ export class UserEntityService implements OnModuleInit {
.where('message.groupId = :groupId', { groupId: j.userGroupId }) .where('message.groupId = :groupId', { groupId: j.userGroupId })
.andWhere('message.userId != :userId', { userId: userId }) .andWhere('message.userId != :userId', { userId: userId })
.andWhere('NOT (:userId = ANY(message.reads))', { 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))); .getOne().then(x => x != null)));
const [withUser, withGroups] = await Promise.all([ const [withUser, withGroups] = await Promise.all([

View File

@ -73,7 +73,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
: history.map(m => (m.userId === me.id) ? m.recipientId! : m.userId!); : history.map(m => (m.userId === me.id) ? m.recipientId! : m.userId!);
const query = this.messagingMessagesRepository.createQueryBuilder('message') const query = this.messagingMessagesRepository.createQueryBuilder('message')
.orderBy('message.createdAt', 'DESC'); .orderBy('message.id', 'DESC');
if (ps.group) { if (ps.group) {
query.where('message.groupId IN (:...groups)', { groups: groups }); query.where('message.groupId IN (:...groups)', { groups: groups });