Skip to content

Commit

Permalink
Avoid sending notification to the reaction on post when the reaction …
Browse files Browse the repository at this point in the history
…is from the post owner.

Signed-off-by: Amir Movahedi <[email protected]>
  • Loading branch information
Qolzam committed Dec 20, 2019
1 parent fd257da commit b5eff1a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/controllers/comments/handlers/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ func CreateCommentHandle(db interface{}) func(server.Request) (handler.Response,
fmt.Println(messageError)
}

if post.OwnerUserId == req.UserID {
// Should not send notification if the owner of the comment is same as owner of post
return
}
URL := fmt.Sprintf("/%s/posts/%s", req.UserID, model.PostId)
notificationModel := &notificationsModels.CreateNotificationModel{
OwnerUserId: req.UserID,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/controllers/votes/handlers/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ func CreateVoteHandle(db interface{}) func(server.Request) (handler.Response, er
fmt.Println(messageError)
}

if post.OwnerUserId == req.UserID {
// Should not send notification if the owner of the vote is same as owner of post
return
}

URL := fmt.Sprintf("/%s/posts/%s", req.UserID, model.PostId)
notificationModel := &notificationsModels.CreateNotificationModel{
OwnerUserId: req.UserID,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b5eff1a

Please sign in to comment.