summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/mastodon/MastodonConverters.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/server/api/mastodon/MastodonConverters.ts')
-rw-r--r--packages/backend/src/server/api/mastodon/MastodonConverters.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/packages/backend/src/server/api/mastodon/MastodonConverters.ts b/packages/backend/src/server/api/mastodon/MastodonConverters.ts
index 0e8ce5a2a7..e5d732ed79 100644
--- a/packages/backend/src/server/api/mastodon/MastodonConverters.ts
+++ b/packages/backend/src/server/api/mastodon/MastodonConverters.ts
@@ -351,12 +351,21 @@ export class MastodonConverters {
};
}
- public async convertNotification(notification: Entity.Notification, me: MiLocalUser | null): Promise<MastodonEntity.Notification> {
+ public async convertNotification(notification: Entity.Notification, me: MiLocalUser | null): Promise<MastodonEntity.Notification | null> {
+ const status = notification.status
+ ? await this.convertStatus(notification.status, me).catch(() => null)
+ : null;
+
+ // We sometimes get notifications for inaccessible notes, these should be ignored.
+ if (!status) {
+ return null;
+ }
+
return {
account: await this.convertAccount(notification.account),
created_at: notification.created_at,
id: notification.id,
- status: notification.status ? await this.convertStatus(notification.status, me) : undefined,
+ status,
type: convertNotificationType(notification.type as NotificationType),
};
}