1
0
forked from mirror/misskey

chore: ba6959b8c1 のリモート対応

This commit is contained in:
syuilo 2021-10-14 01:55:39 +09:00
parent 46f3736f44
commit 8e2be5e9a7
2 changed files with 11 additions and 6 deletions

View File

@ -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
await create(blocker, blockee);
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,

View File

@ -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),