mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 14:07:38 -07:00
sq
This commit is contained in:
parent
cea7232611
commit
7f0d1ae34b
1 changed files with 12 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
|||
import define from '../../define.js';
|
||||
import { MessagingMessage } from '@/models/entities/messaging-message.js';
|
||||
import { MessagingMessages, Mutings, UserGroupJoinings } from '@/models/index.js';
|
||||
import { Brackets } from 'typeorm';
|
||||
import type { MessagingMessage } from '@/models/entities/messaging-message.js';
|
||||
import { MessagingMessages, Mutings, UserGroupJoinings } from '@/models/index.js';
|
||||
import define from '../../define.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['messaging'],
|
||||
|
@ -55,26 +55,26 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||
.orderBy('message.createdAt', 'DESC');
|
||||
|
||||
if (ps.group) {
|
||||
query.where(`message.groupId IN (:...groups)`, { groups: groups });
|
||||
query.where('message.groupId IN (:...groups)', { groups: groups });
|
||||
|
||||
if (found.length > 0) {
|
||||
query.andWhere(`message.groupId NOT IN (:...found)`, { found: found });
|
||||
query.andWhere('message.groupId NOT IN (:...found)', { found: found });
|
||||
}
|
||||
} else {
|
||||
query.where(new Brackets(qb => { qb
|
||||
.where(`message.userId = :userId`, { userId: user.id })
|
||||
.orWhere(`message.recipientId = :userId`, { userId: user.id });
|
||||
.where('message.userId = :userId', { userId: user.id })
|
||||
.orWhere('message.recipientId = :userId', { userId: user.id });
|
||||
}));
|
||||
query.andWhere(`message.groupId IS NULL`);
|
||||
query.andWhere('message.groupId IS NULL');
|
||||
|
||||
if (found.length > 0) {
|
||||
query.andWhere(`message.userId NOT IN (:...found)`, { found: found });
|
||||
query.andWhere(`message.recipientId NOT IN (:...found)`, { found: found });
|
||||
query.andWhere('message.userId NOT IN (:...found)', { found: found });
|
||||
query.andWhere('message.recipientId NOT IN (:...found)', { found: found });
|
||||
}
|
||||
|
||||
if (mute.length > 0) {
|
||||
query.andWhere(`message.userId NOT IN (:...mute)`, { mute: mute.map(m => m.muteeId) });
|
||||
query.andWhere(`message.recipientId NOT IN (:...mute)`, { mute: mute.map(m => m.muteeId) });
|
||||
query.andWhere('message.userId NOT IN (:...mute)', { mute: mute.map(m => m.muteeId) });
|
||||
query.andWhere('message.recipientId NOT IN (:...mute)', { mute: mute.map(m => m.muteeId) });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue