diff --git a/api/user.go b/api/user.go index 1531e96..a497b4d 100644 --- a/api/user.go +++ b/api/user.go @@ -102,8 +102,8 @@ func (client *Client) FetchSubmissions(username string, sort string, page string return submissions, nil } -func (client *Client) FetchUserComments(username string, page string) ([]Comment, error) { - cacheData, found := client.Cache.Get(username + "-usercomments-" + page) +func (client *Client) FetchUserComments(username string) ([]Comment, error) { + cacheData, found := client.Cache.Get(username + "-usercomments") if found { return cacheData.([]Comment), nil } @@ -150,7 +150,7 @@ func (client *Client) FetchUserComments(username string, page string) ([]Comment ) wg.Wait() - client.Cache.Set(username+"-usercomments-"+page, comments, cache.DefaultExpiration) + client.Cache.Set(username+"-usercomments", comments, cache.DefaultExpiration) return comments, nil } diff --git a/pages/user.go b/pages/user.go index 0a9cc4b..e8460c4 100644 --- a/pages/user.go +++ b/pages/user.go @@ -62,16 +62,6 @@ func HandleUserComments(c *fiber.Ctx) error { c.Set("Cache-Control", "public,max-age=604800") c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'; media-src 'self'; style-src 'unsafe-inline' 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content") - page := "0" - if c.Query("page") != "" { - page = c.Query("page") - } - - pageNumber, err := strconv.Atoi(c.Query("page")) - if err != nil { - pageNumber = 0 - } - user, err := ApiClient.FetchUser(c.Params("userID")) if err != nil && err.Error() == "ratelimited by imgur" { return c.Status(429).Render("errors/429", fiber.Map{ @@ -85,7 +75,7 @@ func HandleUserComments(c *fiber.Ctx) error { return c.Status(404).Render("errors/404", nil) } - comments, err := ApiClient.FetchUserComments(c.Params("userID"), page) + comments, err := ApiClient.FetchUserComments(c.Params("userID")) if err != nil && err.Error() == "ratelimited by imgur" { c.Status(429) return c.Render("errors/429", fiber.Map{ @@ -99,8 +89,5 @@ func HandleUserComments(c *fiber.Ctx) error { return c.Render("userComments", fiber.Map{ "user": user, "comments": comments, - "page": page, - "nextPage": pageNumber + 1, - "prevPage": pageNumber - 1, }) } diff --git a/views/userComments.hbs b/views/userComments.hbs index 662c73a..0247a21 100644 --- a/views/userComments.hbs +++ b/views/userComments.hbs @@ -36,14 +36,6 @@ {{> partials/contextComment }} {{/each}} - -