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, + }); + } }, });