OmerFlame / SwiftRant

devRant API library made in Swift.
GNU General Public License v3.0
3 stars 1 forks source link

Downvoting doesn't decrement the score #9

Open WilhelmOks opened 2 years ago

WilhelmOks commented 2 years ago

When I downvote using voteOnRant() with vote: -1, the rant is correctly marked as downvoted but the score is not decremented. It stays the same as it was when not voted. This is not the same behavior as in the original app.

It works for upvoting. The score is incremented by 1. But not for downvoting.

Maybe it has something to do with the original app asking for a reason to downvote?

OmerFlame commented 2 years ago

This is an issue that's already existing for quite a while, I was a bit puzzled on how to fix this. I will have more time tomorrow for more research about this.

WilhelmOks commented 2 years ago

I tested the behavior of the official devRant app and here are my results: Downvoting (with the reason "Not for me") does not have an effect on the score of the user. When I reload the rant, I see that my vote is -- and the score of the rant is one less than before. But the score of the user remains the same.

This leads me to believe that, the official app just shows -1 score point on the rant only in the UI. But the score of the rant and of the user is not changed.

Upvoting on the other hand, does indeed change the rant score and the user score. The user score change is not immidiately visible but increases when the rant is reloaded.

Can you confirm this? If this is correct, then it is not a bug in SwiftRant.

EDIT: Btw, how did you find out how to use the vote endpoint? I couldn't find it on https://devrantapi.docs.apiary.io/#/reference/0/rants And https://devrant-docs.github.io/ gives me 404 and I can't find any other docs. Did you observe and reverse engineer the network traffic?

OmerFlame commented 2 years ago

I can confirm this behavior, this happens with any reason. For now, I am locking, pinning and flagging this issue because other potential users of this library will notice this weird behavior and try posting an issue about this.