Suppress "user not found" log when post not found

This also saves a user suspension check when a post isn't found.
This commit is contained in:
Matt Baer 2019-12-17 20:58:32 -05:00
parent 44a6703742
commit cfea887b78

View file

@ -381,9 +381,12 @@ func handleViewPost(app *App, w http.ResponseWriter, r *http.Request) error {
}
}
suspended, err := app.db.IsUserSuspended(ownerID.Int64)
if err != nil {
log.Error("view post: %v", err)
var suspended bool
if found {
suspended, err = app.db.IsUserSuspended(ownerID.Int64)
if err != nil {
log.Error("view post: %v", err)
}
}
// Check if post has been unpublished