mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-21 03:19:56 +08:00
The discourse-reactions plugin has a rollback function, when the `toggle.json` request fails, the page should rollback the reactions to the original state. However, the function is broken, and the original `_rollbackState()` function never works as the state itself changes when `toggleReaction` is called. And the reaction state never goes back without refreshing/reloading the window, leading to the heart/reactions leaving on the page even when the request failed. This commit fixs this by adding a new function `_captureState()`, keeping the state in a const value, and revert it to the page data when necessary. Also, a spec for this is added to prevent regression. |
||
|---|---|---|
| .. | ||
| acceptance | ||
| fixtures | ||