✨ Community mod able to uncollapse post
This commit is contained in:
		@@ -67,6 +67,7 @@ func MapControllers(app *fiber.App, baseURL string) {
 | 
			
		||||
			posts.Post("/:postId/flag", createFlag)
 | 
			
		||||
			posts.Post("/:postId/react", reactPost)
 | 
			
		||||
			posts.Post("/:postId/pin", pinPost)
 | 
			
		||||
			posts.Post("/:postId/uncollapse", uncollapsePost)
 | 
			
		||||
			posts.Delete("/:postId", deletePost)
 | 
			
		||||
 | 
			
		||||
			posts.Get("/:postId/replies", listPostReplies)
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user