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:
@@ -10,6 +10,8 @@ require('@rails/ujs').start();
|
||||
require('hammerjs');
|
||||
require('jquery-hotkeys');
|
||||
import morphdom from 'morphdom';
|
||||
import Alpine from 'alpinejs';
|
||||
import morph from '@alpinejs/morph';
|
||||
|
||||
// should start looking for nodejs replacements
|
||||
importAll(require.context('../vendor', true, /\.js$/));
|
||||
@@ -93,4 +95,8 @@ Danbooru.error = Utility.error;
|
||||
window.$ = jQuery;
|
||||
window.jQuery = jQuery;
|
||||
window.morphdom = morphdom;
|
||||
window.Alpine = Alpine;
|
||||
window.Danbooru = Danbooru;
|
||||
|
||||
Alpine.plugin(morph);
|
||||
Alpine.start();
|
||||
|
||||
Reference in New Issue
Block a user