Skip to content
Snippets Groups Projects
Commit ba6959b8 authored by syuilo's avatar syuilo
Browse files

fix(api): 管理者およびモデレーターをブロックできてしまう問題を修正

parent 91c9a639
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
- クライアント: ヘッダーのタブが折り返される問題を修正 - クライアント: ヘッダーのタブが折り返される問題を修正
- クライアント: ヘッダーにタブが表示されている状態でタイトルをクリックしたときにタブ選択が表示されるのを修正 - クライアント: ヘッダーにタブが表示されている状態でタイトルをクリックしたときにタブ選択が表示されるのを修正
- クライアント: ユーザーページのタブが機能していない問題を修正 - クライアント: ユーザーページのタブが機能していない問題を修正
- API: 管理者およびモデレーターをブロックできてしまう問題を修正
## 12.91.0 (2021/09/22) ## 12.91.0 (2021/09/22)
......
...@@ -43,6 +43,12 @@ export const meta = { ...@@ -43,6 +43,12 @@ export const meta = {
code: 'ALREADY_BLOCKING', code: 'ALREADY_BLOCKING',
id: '787fed64-acb9-464a-82eb-afbd745b9614' id: '787fed64-acb9-464a-82eb-afbd745b9614'
}, },
cannotBlockModerator: {
message: 'Cannot block a moderator or an admin.',
code: 'CANNOT_BLOCK_MODERATOR',
id: '8544aaef-89fb-e470-9f6c-385d38b474f5'
}
}, },
res: { res: {
...@@ -60,6 +66,10 @@ export default define(meta, async (ps, user) => { ...@@ -60,6 +66,10 @@ export default define(meta, async (ps, user) => {
throw new ApiError(meta.errors.blockeeIsYourself); throw new ApiError(meta.errors.blockeeIsYourself);
} }
if (user.isAdmin || user.isModerator) {
throw new ApiError(meta.errors.cannotBlockModerator);
}
// Get blockee // Get blockee
const blockee = await getUser(ps.userId).catch(e => { const blockee = await getUser(ps.userId).catch(e => {
if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser); if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment