Fix #4945
This commit is contained in:
parent
e103904a04
commit
01fab09683
@ -42,7 +42,13 @@ export const meta = {
|
|||||||
message: 'No such user.',
|
message: 'No such user.',
|
||||||
code: 'NO_SUCH_USER',
|
code: 'NO_SUCH_USER',
|
||||||
id: '0b5cc374-3681-41da-861e-8bc1146f7a55'
|
id: '0b5cc374-3681-41da-861e-8bc1146f7a55'
|
||||||
}
|
},
|
||||||
|
|
||||||
|
isOwner: {
|
||||||
|
message: 'The user is the owner.',
|
||||||
|
code: 'IS_OWNER',
|
||||||
|
id: '1546eed5-4414-4dea-81c1-b0aec4f6d2af'
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -63,6 +69,10 @@ export default define(meta, async (ps, me) => {
|
|||||||
throw e;
|
throw e;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (user.id === userGroup.userId) {
|
||||||
|
throw new ApiError(meta.errors.isOwner);
|
||||||
|
}
|
||||||
|
|
||||||
// Pull the user
|
// Pull the user
|
||||||
await UserGroupJoinings.delete({ userId: user.id });
|
await UserGroupJoinings.delete({ userId: user.id });
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user