enhance(sensitive-flag):センシティブフラグの機能の強化 (MisskeyIO#936)

This commit is contained in:
まっちゃてぃー。 2025-03-18 03:22:08 +09:00 committed by GitHub
parent 7a94724098
commit abdaa18666
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 197 additions and 20 deletions

View file

@ -51,6 +51,12 @@ export const meta = {
code: 'RESTRICTED_BY_ROLE',
id: '7f59dccb-f465-75ab-5cf4-3ce44e3282f7',
},
restrictedByModerator: {
message: 'The isSensitive specified by the administrator cannot be changed.',
code: 'RESTRICTED_BY_ADMINISTRATOR',
id: '20e6c501-e579-400d-97e4-1c7efc286f35',
},
},
res: {
type: 'object',
@ -105,7 +111,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} else if (e instanceof DriveService.NoSuchFolderError) {
throw new ApiError(meta.errors.noSuchFolder);
} else if (e instanceof DriveService.CannotUnmarkSensitiveError) {
throw new ApiError(meta.errors.restrictedByRole);
if (file.isSensitiveByModerator) {
throw new ApiError(meta.errors.restrictedByModerator);
} else {
throw new ApiError(meta.errors.restrictedByRole);
}
} else {
throw e;
}