enhance(moderation): 凍結されたユーザー・削除されたユーザーを可視化できるように (MisskeyIO#676)

This commit is contained in:
nenohi 2024-08-07 05:26:15 +09:00 committed by GitHub
parent 3db41c2d82
commit 787d00bec0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 140 additions and 5 deletions

View file

@ -66,6 +66,13 @@ export const meta = {
id: '4362f8dc-731f-4ad8-a694-be5a88922a24',
httpStatusCode: 404,
},
userSuspended: {
message: 'User is suspended.',
code: 'USER_SUSPENDED',
id: 'c1e1b0d6-2b7c-4c1d-9f1d-2d3d6e8d7e7f',
httpStatusCode: 403,
},
},
} as const;
@ -147,10 +154,19 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
user = await this.usersRepository.findOneBy(q);
}
if (user == null || (!isModerator && user.isSuspended)) {
if (user == null) {
throw new ApiError(meta.errors.noSuchUser);
}
if (!isModerator) {
if (user.isDeleted && user.isSuspended) {
throw new ApiError(meta.errors.noSuchUser);
}
if (user.isSuspended) {
throw new ApiError(meta.errors.userSuspended);
}
}
if (user.host == null) {
if (me == null && ip != null) {
this.perUserPvChart.commitByVisitor(user, ip);