This commit is contained in:
syuilo 2019-10-21 00:52:50 +09:00
parent 5dc7cdeba6
commit df3c05c6fb
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 != \'{}\'');