Skip to content

Commit

Permalink
fix(backend): Inboxのエラーをthrowせずreturnしている問題を修正 (misskey-dev#15022)
Browse files Browse the repository at this point in the history
* fix exception handling for Like activities

(cherry picked from commit 8f42e84)

* fix exception handling for Announce activities

(cherry picked from commit cfc3ab4)

* fix exception handling for Undo activities

* Update Changelog

---------

Co-authored-by: Hazelnoot <[email protected]>
(cherry picked from commit f25fc52)
  • Loading branch information
kakkokari-gtyih authored and u1-liquid committed Dec 24, 2024
1 parent e3cad43 commit c6b6aab
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/backend/src/core/activitypub/ApInboxService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { bindThis } from '@/decorators.js';
import type { MiLocalUser, MiRemoteUser } from '@/models/User.js';
import { isNotNull } from '@/misc/is-not-null.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
import { IdentifiableError } from '@/misc/identifiable-error.js';
import { getApHrefNullable, getApId, getApIds, getApType, isAccept, isActor, isAdd, isAnnounce, isBlock, isCollection, isCollectionOrOrderedCollection, isCreate, isDelete, isFlag, isFollow, isLike, isMove, isPost, isReject, isRemove, isTombstone, isUndo, isUpdate, validActor, validPost } from './type.js';
import { ApNoteService } from './models/ApNoteService.js';
import { ApLoggerService } from './ApLoggerService.js';
Expand Down Expand Up @@ -203,13 +204,16 @@ export class ApInboxService {

await this.apNoteService.extractEmojis(activity.tag ?? [], actor.host).catch(() => null);

return await this.reactionService.create(actor, note, activity._misskey_reaction ?? activity.content ?? activity.name).catch(err => {
if (err.id === '51c42bb4-931a-456b-bff7-e5a8a70dd298') {
try {
await this.reactionService.create(actor, note, activity._misskey_reaction ?? activity.content ?? activity.name);
return 'ok';
} catch (err) {
if (err instanceof IdentifiableError && err.id === '51c42bb4-931a-456b-bff7-e5a8a70dd298') {
return 'skip: already reacted';
} else {
throw err;
}
}).then(() => 'ok');
}
}

@bindThis
Expand Down

0 comments on commit c6b6aab

Please sign in to comment.