Skip to content

Commit

Permalink
fix(server): comment created notification
Browse files Browse the repository at this point in the history
  • Loading branch information
lareii committed Sep 20, 2024
1 parent 1177e95 commit a1c6683
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions server/handlers/comments/create_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ func CreateComment(c *fiber.Ctx) error {
})
}

notification := models.Notification{
TargetUserID: post.Author,
SourceUserID: user.ID,
Type: "comment_created",
TypeContent: post.ID.Hex(),
if user.ID != post.Author {
notification := models.Notification{
TargetUserID: post.Author,
SourceUserID: user.ID,
Type: "comment_created",
TypeContent: post.ID.Hex(),
}
_ = models.CreateNotification(notification)
}
_ = models.CreateNotification(notification)

return c.Status(fiber.StatusCreated).JSON(models.CommentResponse{
Message: "Comment created.",
Expand Down

0 comments on commit a1c6683

Please sign in to comment.