sublinks / sublinks-api

MIT License
68 stars 17 forks source link

401 API error when setting post like/vote score to 0 #288

Closed kgilles closed 3 months ago

kgilles commented 3 months ago

When a user submits a vote/like for a post a request is sent to the /api/v3/post/like route with an example payload such as

{
    "post_id": 32,
    "score": 1
}

This works well when up- or downvoting a post. Ie. sending in a score value of 1 or -1. But when sending in a score value of 0, the API always responds with a 401 Unauthorized error.

Reproduce

  1. Login as a non-admin user
  2. Find or create a post
  3. If in frontend UI, click the upvote button twice (can use Postman or similar program for this)
  4. The first click, the vote score of 1 goes through fine
  5. The second click, the vote score of 0 causes 401 error
Pdzly commented 3 months ago

Same issue on comment vote