Community mod able to uncollapse post

This commit is contained in:
2025-04-05 12:17:48 +08:00
parent d189c5a8d8
commit ac30cb5e4d
2 changed files with 15 additions and 0 deletions

View File

@@ -372,3 +372,17 @@ func pinPost(c *fiber.Ctx) error {
return c.SendStatus(fiber.StatusNoContent)
}
}
func uncollapsePost(c *fiber.Ctx) error {
id, _ := c.ParamsInt("postId", 0)
if err := sec.EnsureGrantedPerm(c, "UncollapsePosts", true); err != nil {
return err
}
if err := database.C.Model(&models.Post{}).Where("id = ?", id).Update("is_collapsed", false).Error; err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
}
return c.SendStatus(fiber.StatusOK)
}