Hide suspended user profile (#5452)
This commit is contained in:
parent
a3c7901f87
commit
541f5f1314
6 changed files with 40 additions and 11 deletions
|
@ -3,7 +3,7 @@ import { ID } from '../../../../misc/cafy-id';
|
|||
import { readNotification } from '../../common/read-notification';
|
||||
import define from '../../define';
|
||||
import { makePaginationQuery } from '../../common/make-pagination-query';
|
||||
import { Notifications, Followings, Mutings } from '../../../../models';
|
||||
import { Notifications, Followings, Mutings, Users } from '../../../../models';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
|
@ -72,6 +72,10 @@ export default define(meta, async (ps, user) => {
|
|||
.select('muting.muteeId')
|
||||
.where('muting.muterId = :muterId', { muterId: user.id });
|
||||
|
||||
const suspendedQuery = Users.createQueryBuilder('users')
|
||||
.select('id')
|
||||
.where('users.isSuspended = TRUE');
|
||||
|
||||
const query = makePaginationQuery(Notifications.createQueryBuilder('notification'), ps.sinceId, ps.untilId)
|
||||
.andWhere(`notification.notifieeId = :meId`, { meId: user.id })
|
||||
.leftJoinAndSelect('notification.notifier', 'notifier');
|
||||
|
@ -79,6 +83,8 @@ export default define(meta, async (ps, user) => {
|
|||
query.andWhere(`notification.notifierId NOT IN (${ mutingQuery.getQuery() })`);
|
||||
query.setParameters(mutingQuery.getParameters());
|
||||
|
||||
query.andWhere(`notification.notifierId NOT IN (${ suspendedQuery.getQuery() })`);
|
||||
|
||||
if (ps.following) {
|
||||
query.andWhere(`((notification.notifierId IN (${ followingQuery.getQuery() })) OR (notification.notifierId = :meId))`, { meId: user.id });
|
||||
query.setParameters(followingQuery.getParameters());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue