Fix flagging debates and comments with AJAX

We weren't using `foundation()` in these cases, so after flagging a
debate or a comment, we had to reload the page before we could unflag
it.

We're also adding a test for the fix in commit ea85059d. This test shows
it's necessary to filter the elements with JavaSctipt using `first()` if
we want the same code to work with comments.

Co-Authored-By: taitus <sebastia.roig@gmail.com>
This commit is contained in:
Javi Martín
2020-03-20 15:47:02 +01:00
parent 328ec5e25f
commit 9937e94fcd
6 changed files with 58 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
"use strict";
App.Flaggable = {
update: function(resource_id, button) {
$("#" + resource_id + " .js-flag-actions").html(button).foundation();
$("#" + resource_id + " .js-flag-actions").first().html(button).foundation();
}
};
}).call(this);