reaction.js: Maintain reaction_show_list.

This updates reaction_show_list whenever the popover
gets opened and whenever the search filter for reactions
gets used.
This commit is contained in:
Joshua Pan 2017-04-19 05:54:21 +00:00
parent cd28ea6d07
commit e075c84ca5
2 changed files with 11 additions and 0 deletions

View File

@ -221,6 +221,7 @@ exports.toggle_reactions_popover = function (element, id) {
wheelSpeed: 25,
});
current_message_reactions_popover_elem = elt;
reactions.render_reaction_show_list();
}
};

View File

@ -73,6 +73,15 @@ exports.toggle_reaction = function (message_id, emoji_name) {
popovers.hide_reactions_popover();
};
var reaction_show_list = []; // local reaction_show_list
exports.render_reaction_show_list = function () {
var reaction_list = $(".reaction-popover-reaction");
reaction_show_list = reaction_list.filter(function () {
return this.style.display === "block" || this.style.display === "";
}).toArray();
};
function filter_emojis() {
var elt = $(".reaction-popover-filter").expectOne();
var search_term = elt.val().trim();
@ -87,6 +96,7 @@ function filter_emojis() {
} else {
reaction_list.css("display", "block");
}
exports.render_reaction_show_list();
}
function maybe_select_emoji(e) {