From 574ac2e5225837d0d2108bd233d273d0e34dc82a Mon Sep 17 00:00:00 2001 From: Web Dev Cody Date: Wed, 7 Feb 2024 12:16:44 -0500 Subject: [PATCH] reverse profile order --- convex/notification.ts | 2 +- convex/thumbnails.ts | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/convex/notification.ts b/convex/notification.ts index 06c5614..bfd181f 100644 --- a/convex/notification.ts +++ b/convex/notification.ts @@ -51,7 +51,7 @@ export const getNotifications = authQuery({ return { ...notification, thumbnail: await ctx.db.get(notification.thumbnailId), - profile: await getProfile(ctx, { userId: notification.userId }), + profile: await getProfile(ctx, { userId: notification.from }), }; }) ); diff --git a/convex/thumbnails.ts b/convex/thumbnails.ts index 3c01648..b9d2889 100644 --- a/convex/thumbnails.ts +++ b/convex/thumbnails.ts @@ -105,13 +105,15 @@ export const addComment = authMutation({ profileUrl: ctx.user.profileImage ?? "", }); - await ctx.db.insert("notifications", { - from: ctx.user._id, - isRead: false, - thumbnailId: args.thumbnailId, - type: "comment", - userId: thumbnail.userId, - }); + if (ctx.user._id !== thumbnail.userId) { + await ctx.db.insert("notifications", { + from: ctx.user._id, + isRead: false, + thumbnailId: args.thumbnailId, + type: "comment", + userId: thumbnail.userId, + }); + } }, });