diff options
| author | anatawa12 <anatawa12@icloud.com> | 2023-10-30 13:48:22 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-30 13:48:22 +0900 |
| commit | 7015cc937bd872e9c7ebafb56bdaea4ca138e0df (patch) | |
| tree | 4cba42621dea7c76c4e8240d649202263710c7ba /packages/backend/src/server | |
| parent | enhance(frontend): URL入力フォームのtypeをurlに (diff) | |
| download | misskey-7015cc937bd872e9c7ebafb56bdaea4ca138e0df.tar.gz misskey-7015cc937bd872e9c7ebafb56bdaea4ca138e0df.tar.bz2 misskey-7015cc937bd872e9c7ebafb56bdaea4ca138e0df.zip | |
fix(backend): We can renote pure renote (#12171)
* chore: make pure renote detection an function
* fix: we can renote pure renote
* docs(changelog): リノートをリノートできるのを修正
* fix: remaining debug log
* chore: move isPureRenote to misc
* chore: make isPureRenote type guard
* chore: use isPureRenote in other places
* fix CHANGELOG
* style: fix lint
---------
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/backend/src/server')
| -rw-r--r-- | packages/backend/src/server/ActivityPubServerService.ts | 3 | ||||
| -rw-r--r-- | packages/backend/src/server/api/endpoints/notes/create.ts | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/backend/src/server/ActivityPubServerService.ts b/packages/backend/src/server/ActivityPubServerService.ts index a7f6f82daf..2e64d41c91 100644 --- a/packages/backend/src/server/ActivityPubServerService.ts +++ b/packages/backend/src/server/ActivityPubServerService.ts @@ -26,6 +26,7 @@ import { UtilityService } from '@/core/UtilityService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { bindThis } from '@/decorators.js'; import { IActivity } from '@/core/activitypub/type.js'; +import { isPureRenote } from '@/misc/is-pure-renote.js'; import type { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginOptions } from 'fastify'; import type { FindOptionsWhere } from 'typeorm'; @@ -88,7 +89,7 @@ export class ActivityPubServerService { */ @bindThis private async packActivity(note: MiNote): Promise<any> { - if (note.renoteId && note.text == null && !note.hasPoll && (note.fileIds == null || note.fileIds.length === 0)) { + if (isPureRenote(note)) { const renote = await this.notesRepository.findOneByOrFail({ id: note.renoteId }); return this.apRendererService.renderAnnounce(renote.uri ? renote.uri : `${this.config.url}/notes/${renote.id}`, note); } diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 3ae4ac044a..649068fb20 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -17,6 +17,7 @@ import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { NoteCreateService } from '@/core/NoteCreateService.js'; import { DI } from '@/di-symbols.js'; import { ApiError } from '../../error.js'; +import { isPureRenote } from '@/misc/is-pure-renote.js'; export const meta = { tags: ['notes'], @@ -221,7 +222,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- if (renote == null) { throw new ApiError(meta.errors.noSuchRenoteTarget); - } else if (renote.renoteId && !renote.text && !renote.fileIds && !renote.hasPoll) { + } else if (isPureRenote(renote)) { throw new ApiError(meta.errors.cannotReRenote); } @@ -254,7 +255,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- if (reply == null) { throw new ApiError(meta.errors.noSuchReplyTarget); - } else if (reply.renoteId && !reply.text && !reply.fileIds && !reply.hasPoll) { + } else if (isPureRenote(reply)) { throw new ApiError(meta.errors.cannotReplyToPureRenote); } |