enhance(moderation): Bot同士ではフォロー・リプライができないように (MisskeyIO#678)
This commit is contained in:
parent
787d00bec0
commit
50066cda20
3 changed files with 23 additions and 0 deletions
|
@ -58,6 +58,12 @@ export const meta = {
|
||||||
code: 'BLOCKED',
|
code: 'BLOCKED',
|
||||||
id: 'c4ab57cc-4e41-45e9-bfd9-584f61e35ce0',
|
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: {
|
res: {
|
||||||
|
@ -100,6 +106,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ( me.isBot && followee.isBot ) {
|
||||||
|
throw new ApiError(meta.errors.followingAnotherBot);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.userFollowingService.follow(follower, followee, { withReplies: ps.withReplies });
|
await this.userFollowingService.follow(follower, followee, { withReplies: ps.withReplies });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -141,6 +141,13 @@ export const meta = {
|
||||||
code: 'CONTAINS_TOO_MANY_MENTIONS',
|
code: 'CONTAINS_TOO_MANY_MENTIONS',
|
||||||
id: '4de0363a-3046-481b-9b0f-feff3e211025',
|
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;
|
} as const;
|
||||||
|
|
||||||
|
@ -375,6 +382,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new ApiError(meta.errors.cannotReplyToInvisibleNote);
|
throw new ApiError(meta.errors.cannotReplyToInvisibleNote);
|
||||||
} else if (reply.visibility === 'specified' && ps.visibility !== 'specified') {
|
} else if (reply.visibility === 'specified' && ps.visibility !== 'specified') {
|
||||||
throw new ApiError(meta.errors.cannotReplyToSpecifiedVisibilityNoteWithExtendedVisibility);
|
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
|
// Check blocking
|
||||||
|
|
|
@ -4910,6 +4910,7 @@ export type components = {
|
||||||
canSearchNotes: boolean;
|
canSearchNotes: boolean;
|
||||||
canUseTranslator: boolean;
|
canUseTranslator: boolean;
|
||||||
canUseDriveFileInSoundSettings: boolean;
|
canUseDriveFileInSoundSettings: boolean;
|
||||||
|
canUseReaction: boolean;
|
||||||
canHideAds: boolean;
|
canHideAds: boolean;
|
||||||
driveCapacityMb: number;
|
driveCapacityMb: number;
|
||||||
alwaysMarkNsfw: boolean;
|
alwaysMarkNsfw: boolean;
|
||||||
|
|
Loading…
Reference in a new issue