chore: ba6959b8c1
のリモート対応
This commit is contained in:
parent
46f3736f44
commit
8e2be5e9a7
@ -66,10 +66,6 @@ export default define(meta, async (ps, user) => {
|
||||
throw new ApiError(meta.errors.blockeeIsYourself);
|
||||
}
|
||||
|
||||
if (user.isAdmin || user.isModerator) {
|
||||
throw new ApiError(meta.errors.cannotBlockModerator);
|
||||
}
|
||||
|
||||
// Get blockee
|
||||
const blockee = await getUser(ps.userId).catch(e => {
|
||||
if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
|
||||
@ -86,8 +82,12 @@ export default define(meta, async (ps, user) => {
|
||||
throw new ApiError(meta.errors.alreadyBlocking);
|
||||
}
|
||||
|
||||
// Create blocking
|
||||
try {
|
||||
await create(blocker, blockee);
|
||||
} catch (e) {
|
||||
if (e.id === 'e42b7890-5e4d-9d9c-d54b-cf4dd30adfb5') throw new ApiError(meta.errors.cannotBlockModerator);
|
||||
throw e;
|
||||
}
|
||||
|
||||
NoteWatchings.delete({
|
||||
userId: blocker.id,
|
||||
|
@ -9,8 +9,13 @@ import { User } from '@/models/entities/user';
|
||||
import { Blockings, Users, FollowRequests, Followings, UserListJoinings, UserLists } from '@/models/index';
|
||||
import { perUserFollowingChart } from '@/services/chart/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error';
|
||||
|
||||
export default async function(blocker: User, blockee: User) {
|
||||
if (blockee.isAdmin || blockee.isModerator) {
|
||||
throw new IdentifiableError('e42b7890-5e4d-9d9c-d54b-cf4dd30adfb5');
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
cancelRequest(blocker, blockee),
|
||||
cancelRequest(blockee, blocker),
|
||||
|
Loading…
Reference in New Issue
Block a user