🐛 Fix get post will ignore visibility
This commit is contained in:
parent
13a65ad518
commit
41af202623
@ -22,6 +22,13 @@ func getPost(c *fiber.Ctx) error {
|
|||||||
var err error
|
var err error
|
||||||
|
|
||||||
tx := services.FilterPostDraft(database.C)
|
tx := services.FilterPostDraft(database.C)
|
||||||
|
|
||||||
|
if user, authenticated := c.Locals("user").(models.Account); authenticated {
|
||||||
|
tx = services.FilterPostWithUserContext(tx, &user)
|
||||||
|
} else {
|
||||||
|
tx = services.FilterPostWithUserContext(tx, nil)
|
||||||
|
}
|
||||||
|
|
||||||
if numericId, paramErr := strconv.Atoi(id); paramErr == nil {
|
if numericId, paramErr := strconv.Atoi(id); paramErr == nil {
|
||||||
item, err = services.GetPost(tx, uint(numericId))
|
item, err = services.GetPost(tx, uint(numericId))
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user