Double XP now has a constant for unixtime to start. Logic around
DXP is designed to only apply to votes made after DOUBLE_XP_ENABLED.
This prevents an exploit in the old implementation where spam voting/
unvoting a post made prior to the DXP start could farm 300 DC/hr/alt.
Also it's more maintainable and comports with the coin_delta changes
to prevent self-vote coin changes.
Fixes minor UI bug when removing self-upvote on a comment. Previous
behavior, starting from a new comment:
- Initial state: score 1 from self-upvote, upvote button shows
highlighted as `color: var(--primary)`.
- Click on upvote button to remove self-upvote → button
unhighlights, score displays as 0.
- [reload page]
- Score displays as 0, but button is highlighted.
- Click on upvote button → button unhighlights, score displays
as -1. [If you reload the page now, state is score 0 &
highlighted; no change in serverside votes.]
- Click on upvote again → button highlights, score displays as 0.
- [reload page]
- Score displays as 1, button is highlighted.
Direct cause is `templates/comments.html @ L115-117`. I checked
`api_comment`, though, and it adds a vote on new comments, and that
state change propagates to the template's parameters before it renders,
so I believe the only time this triggers is specifically when a user
has removed their self-upvote. Bug is fixed when testing with L115-117
removed. Is there some other edge case it was meant to solve?
Secondary bugfix: Removing a self-upvote _costs_ you a coin & a
truescore point. I think this is one of the few ways to get negative
dramacoin. I chose to fix it by having self-votes and self-unvotes not
change coins/truecoins. The alternative of having new comments & posts
give the user +1 coin/truecoin would modify site behavior, and you'd
retroactively owe some powerusers thousands of DC & truescore.