This commit is contained in:
syuilo 2019-10-21 00:52:50 +09:00
parent d672bb4643
commit 7ff8fb027d
2 changed files with 6 additions and 2 deletions

View File

@ -2,11 +2,15 @@ import { User } from '../../../models/entities/user';
import { Mutings } from '../../../models';
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')
.select('muting.muteeId')
.where('muting.muterId = :muterId', { muterId: me.id });
if (exclude) {
mutingQuery.andWhere('muting.muteeId != :excludeId', { excludeId: exclude.id });
}
// 投稿の作者をミュートしていない かつ
// 投稿の返信先の作者をミュートしていない かつ
// 投稿の引用元の作者をミュートしていない

View File

@ -134,7 +134,7 @@ export default define(meta, async (ps, me) => {
.leftJoinAndSelect('note.user', 'user');
if (me) generateVisibilityQuery(query, me);
if (me) generateMuteQuery(query, me);
if (me) generateMuteQuery(query, me, user);
if (ps.withFiles) {
query.andWhere('note.fileIds != \'{}\'');