Fix #5021: Downvoting/upvoting a revealed hidden comment will hide it again.

Fix it so that upvoting or downvoting a revealed thresholded comment
doesn't hide it again.

The fix is to explicitly store a `data-show-thresholded` flag on the
comment, instead of manually hiding elements with jQuery, and to morph
the comment HTML instead of replacing it so that the state isn't lost
after voting. Alpine.js is used for this, which isn't strictly necessary,
but is useful to test the library before adopting it on a wider scale.

https://alpinejs.dev/start-here
This commit is contained in:
evazion
2022-02-28 19:51:27 -06:00
parent 8ab0803e00
commit 8ef05ec69b
7 changed files with 61 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
{
"license": "MIT",
"dependencies": {
"@alpinejs/morph": "^3.9.0",
"@babel/plugin-proposal-decorators": "^7.16.7",
"@fontsource/anton": "^4.0.0",
"@fontsource/archivo-narrow": "^4.0.0",
@@ -14,6 +15,7 @@
"@rails/ujs": "^7.0.1",
"@rails/webpacker": "=6.0.0-rc.6",
"@ruffle-rs/ruffle": "0.1.0-nightly.2022.1.31",
"alpinejs": "^3.9.0",
"core-js": "^3.20.3",
"css-loader": "^6.5.1",
"dropzone": "^6.0.0-beta.2",