fix(api): 🐛 Fix reblog notifications not having proper notes attached

This commit is contained in:
Jesse Wierzbinski 2024-04-26 10:13:02 -10:00
parent ce0cfb4152
commit b37921d0a3
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View file

@ -148,7 +148,7 @@ describe(meta.route, () => {
const objects = (await response.json()) as APINotification[]; 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 // There should be no element with a status with id of timeline[0].id
expect(objects).not.toContainEqual( expect(objects).not.toContainEqual(
expect.objectContaining({ expect.objectContaining({

View file

@ -75,12 +75,12 @@ export default apiRoute<typeof meta, typeof schema>(
} }
// Create notification for reblog if reblogged user is on the same instance // 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({ await db.insert(Notifications).values({
accountId: user.id, accountId: user.id,
notifiedId: foundStatus.getAuthor().id, notifiedId: foundStatus.getAuthor().id,
type: "reblog", type: "reblog",
noteId: foundStatus.getStatus().reblogId, noteId: newReblog.reblogId,
}); });
} }