Compare commits
No commits in common. "ac30cb5e4d1740eddc91944213f7e86aa0d5ee1a" and "69e9a108ef33fe2cae2924c2dadbe325d8bf6472" have entirely different histories.
ac30cb5e4d
...
69e9a108ef
@ -67,7 +67,6 @@ 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,17 +372,3 @@ 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)
|
||||
}
|
||||
|
@ -26,10 +26,6 @@ func NewFlag(post models.Post, account uint) (models.PostFlag, error) {
|
||||
}
|
||||
|
||||
func FlagCalculateCollapseStatus(post models.Post) error {
|
||||
if post.TotalViews <= 2 {
|
||||
return nil
|
||||
}
|
||||
|
||||
collapseLimit := 0.5
|
||||
|
||||
var flagCount int64
|
||||
|
@ -48,6 +48,9 @@ func UniversalPostFilter(c *fiber.Ctx, tx *gorm.DB, cfg ...UniversalPostFilterCo
|
||||
if c.QueryBool("noReply", true) && !config.ShowReply {
|
||||
tx = FilterPostReply(tx)
|
||||
}
|
||||
if c.QueryBool("noCollapse", true) && !config.ShowCollapsed {
|
||||
tx = tx.Where("is_collapsed = ? OR is_collapsed IS NULL", false)
|
||||
}
|
||||
|
||||
if len(c.Query("author")) > 0 {
|
||||
var author models.Publisher
|
||||
|
Loading…
x
Reference in New Issue
Block a user