forked from FoundKeyGang/FoundKey
Fix #4731
This commit is contained in:
parent
d672bb4643
commit
7ff8fb027d
2 changed files with 6 additions and 2 deletions
|
@ -2,11 +2,15 @@ import { User } from '../../../models/entities/user';
|
||||||
import { Mutings } from '../../../models';
|
import { Mutings } from '../../../models';
|
||||||
import { SelectQueryBuilder, Brackets } from 'typeorm';
|
import { SelectQueryBuilder, Brackets } from 'typeorm';
|
||||||
|
|
||||||
export function generateMuteQuery(q: SelectQueryBuilder<any>, me: User) {
|
export function generateMuteQuery(q: SelectQueryBuilder<any>, me: User, exclude?: User) {
|
||||||
const mutingQuery = Mutings.createQueryBuilder('muting')
|
const mutingQuery = Mutings.createQueryBuilder('muting')
|
||||||
.select('muting.muteeId')
|
.select('muting.muteeId')
|
||||||
.where('muting.muterId = :muterId', { muterId: me.id });
|
.where('muting.muterId = :muterId', { muterId: me.id });
|
||||||
|
|
||||||
|
if (exclude) {
|
||||||
|
mutingQuery.andWhere('muting.muteeId != :excludeId', { excludeId: exclude.id });
|
||||||
|
}
|
||||||
|
|
||||||
// 投稿の作者をミュートしていない かつ
|
// 投稿の作者をミュートしていない かつ
|
||||||
// 投稿の返信先の作者をミュートしていない かつ
|
// 投稿の返信先の作者をミュートしていない かつ
|
||||||
// 投稿の引用元の作者をミュートしていない
|
// 投稿の引用元の作者をミュートしていない
|
||||||
|
|
|
@ -134,7 +134,7 @@ export default define(meta, async (ps, me) => {
|
||||||
.leftJoinAndSelect('note.user', 'user');
|
.leftJoinAndSelect('note.user', 'user');
|
||||||
|
|
||||||
if (me) generateVisibilityQuery(query, me);
|
if (me) generateVisibilityQuery(query, me);
|
||||||
if (me) generateMuteQuery(query, me);
|
if (me) generateMuteQuery(query, me, user);
|
||||||
|
|
||||||
if (ps.withFiles) {
|
if (ps.withFiles) {
|
||||||
query.andWhere('note.fileIds != \'{}\'');
|
query.andWhere('note.fileIds != \'{}\'');
|
||||||
|
|
Loading…
Reference in a new issue