|
|
@ -381,10 +381,12 @@ func handleViewPost(app *App, w http.ResponseWriter, r *http.Request) error { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
suspended, err := app.db.IsUserSuspended(ownerID.Int64) |
|
|
|
var suspended bool |
|
|
|
if err != nil { |
|
|
|
if found { |
|
|
|
log.Error("view post: %v", err) |
|
|
|
suspended, err = app.db.IsUserSuspended(ownerID.Int64) |
|
|
|
return ErrInternalGeneral |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
log.Error("view post: %v", err) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Check if post has been unpublished
|
|
|
|
// Check if post has been unpublished
|
|
|
@ -511,7 +513,6 @@ func newPost(app *App, w http.ResponseWriter, r *http.Request) error { |
|
|
|
suspended, err := app.db.IsUserSuspended(userID) |
|
|
|
suspended, err := app.db.IsUserSuspended(userID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("new post: %v", err) |
|
|
|
log.Error("new post: %v", err) |
|
|
|
return ErrInternalGeneral |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if suspended { |
|
|
|
if suspended { |
|
|
|
return ErrUserSuspended |
|
|
|
return ErrUserSuspended |
|
|
@ -685,7 +686,6 @@ func existingPost(app *App, w http.ResponseWriter, r *http.Request) error { |
|
|
|
suspended, err := app.db.IsUserSuspended(userID) |
|
|
|
suspended, err := app.db.IsUserSuspended(userID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("existing post: %v", err) |
|
|
|
log.Error("existing post: %v", err) |
|
|
|
return ErrInternalGeneral |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if suspended { |
|
|
|
if suspended { |
|
|
|
return ErrUserSuspended |
|
|
|
return ErrUserSuspended |
|
|
@ -888,7 +888,6 @@ func addPost(app *App, w http.ResponseWriter, r *http.Request) error { |
|
|
|
suspended, err := app.db.IsUserSuspended(ownerID) |
|
|
|
suspended, err := app.db.IsUserSuspended(ownerID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("add post: %v", err) |
|
|
|
log.Error("add post: %v", err) |
|
|
|
return ErrInternalGeneral |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if suspended { |
|
|
|
if suspended { |
|
|
|
return ErrUserSuspended |
|
|
|
return ErrUserSuspended |
|
|
@ -991,7 +990,6 @@ func pinPost(app *App, w http.ResponseWriter, r *http.Request) error { |
|
|
|
suspended, err := app.db.IsUserSuspended(userID) |
|
|
|
suspended, err := app.db.IsUserSuspended(userID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("pin post: %v", err) |
|
|
|
log.Error("pin post: %v", err) |
|
|
|
return ErrInternalGeneral |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if suspended { |
|
|
|
if suspended { |
|
|
|
return ErrUserSuspended |
|
|
|
return ErrUserSuspended |
|
|
@ -1073,7 +1071,6 @@ func fetchPost(app *App, w http.ResponseWriter, r *http.Request) error { |
|
|
|
suspended, err := app.db.IsUserSuspended(p.OwnerID.Int64) |
|
|
|
suspended, err := app.db.IsUserSuspended(p.OwnerID.Int64) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("fetch post: %v", err) |
|
|
|
log.Error("fetch post: %v", err) |
|
|
|
return ErrInternalGeneral |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if suspended { |
|
|
|
if suspended { |
|
|
|
return ErrPostNotFound |
|
|
|
return ErrPostNotFound |
|
|
@ -1335,7 +1332,6 @@ func viewCollectionPost(app *App, w http.ResponseWriter, r *http.Request) error |
|
|
|
suspended, err := app.db.IsUserSuspended(c.OwnerID) |
|
|
|
suspended, err := app.db.IsUserSuspended(c.OwnerID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("view collection post: %v", err) |
|
|
|
log.Error("view collection post: %v", err) |
|
|
|
return ErrInternalGeneral |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Check collection permissions
|
|
|
|
// Check collection permissions
|
|
|
|