From b37921d0a32f8897daa0dd76a3fc8469237837d9 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Fri, 26 Apr 2024 10:13:02 -1000 Subject: [PATCH] fix(api): :bug: Fix reblog notifications not having proper notes attached --- server/api/api/v1/notifications/index.test.ts | 2 +- server/api/api/v1/statuses/[id]/reblog.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/api/api/v1/notifications/index.test.ts b/server/api/api/v1/notifications/index.test.ts index 40794b10..b5664885 100644 --- a/server/api/api/v1/notifications/index.test.ts +++ b/server/api/api/v1/notifications/index.test.ts @@ -148,7 +148,7 @@ describe(meta.route, () => { const objects = (await response.json()) as APINotification[]; - expect(objects.length).toBe(3); + expect(objects.length).toBe(2); // There should be no element with a status with id of timeline[0].id expect(objects).not.toContainEqual( expect.objectContaining({ diff --git a/server/api/api/v1/statuses/[id]/reblog.ts b/server/api/api/v1/statuses/[id]/reblog.ts index 2c77420b..2eb1bd71 100644 --- a/server/api/api/v1/statuses/[id]/reblog.ts +++ b/server/api/api/v1/statuses/[id]/reblog.ts @@ -75,12 +75,12 @@ export default apiRoute( } // Create notification for reblog if reblogged user is on the same instance - if (foundStatus.getAuthor().instanceId === user.instanceId) { + if (foundStatus.getAuthor().isLocal() && user.isLocal()) { await db.insert(Notifications).values({ accountId: user.id, notifiedId: foundStatus.getAuthor().id, type: "reblog", - noteId: foundStatus.getStatus().reblogId, + noteId: newReblog.reblogId, }); }