1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-04 01:38:48 +09:00

enhance(moderation): Bot同士ではフォロー・リプライができないように (MisskeyIO#678)

This commit is contained in:
nenohi 2024-08-08 06:15:14 +09:00 committed by GitHub
parent 787d00bec0
commit 50066cda20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 0 deletions

View File

@ -58,6 +58,12 @@ export const meta = {
code: 'BLOCKED',
id: 'c4ab57cc-4e41-45e9-bfd9-584f61e35ce0',
},
followingAnotherBot: {
message: 'Following another bot account is not allowed.',
code: 'FOLLOWING_BOT_NOT_ALLOWED',
id: '9a61d572-4a95-7f6b-b595-2817d42017b0',
},
},
res: {
@ -100,6 +106,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw err;
});
if ( me.isBot && followee.isBot ) {
throw new ApiError(meta.errors.followingAnotherBot);
}
try {
await this.userFollowingService.follow(follower, followee, { withReplies: ps.withReplies });
} catch (e) {

View File

@ -141,6 +141,13 @@ export const meta = {
code: 'CONTAINS_TOO_MANY_MENTIONS',
id: '4de0363a-3046-481b-9b0f-feff3e211025',
},
replyingToAnotherBot: {
message: 'Replying to another bot account is not allowed.',
code: 'REPLY_TO_BOT_NOT_ALLOWED',
id: '66819f28-9525-389d-4b0a-4974363fbbbf',
},
},
} as const;
@ -375,6 +382,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new ApiError(meta.errors.cannotReplyToInvisibleNote);
} else if (reply.visibility === 'specified' && ps.visibility !== 'specified') {
throw new ApiError(meta.errors.cannotReplyToSpecifiedVisibilityNoteWithExtendedVisibility);
} else if ( me.isBot ) {
const replayuser = await this.usersRepository.findOneBy({ id: reply.userId });
if (replayuser?.isBot) {
throw new ApiError(meta.errors.replyingToAnotherBot);
}
}
// Check blocking

View File

@ -4910,6 +4910,7 @@ export type components = {
canSearchNotes: boolean;
canUseTranslator: boolean;
canUseDriveFileInSoundSettings: boolean;
canUseReaction: boolean;
canHideAds: boolean;
driveCapacityMb: number;
alwaysMarkNsfw: boolean;