Skip to content

Commit

Permalink
reverse profile order
Browse files Browse the repository at this point in the history
  • Loading branch information
webdevcody committed Feb 7, 2024
1 parent 3a36000 commit 574ac2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion convex/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
};
})
);
Expand Down
16 changes: 9 additions & 7 deletions convex/thumbnails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
},
});

Expand Down

0 comments on commit 574ac2e

Please sign in to comment.