🐛 Fix get post will ignore visibility

This commit is contained in:
LittleSheep 2024-09-16 21:28:48 +08:00
parent 13a65ad518
commit 41af202623

View File

@ -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 {