Remove topic popovers when redrawing topics

(imported from commit 5350e5026dcfc9542c44b576ee967423adaf2c91)
This commit is contained in:
Steve Howell 2013-09-18 11:30:26 -04:00
parent 0a1a63c87f
commit fd81e04e16
2 changed files with 8 additions and 5 deletions

View File

@ -174,10 +174,15 @@ exports.remove_all_narrow_filters = function () {
$("#stream_filters").children().remove(); $("#stream_filters").children().remove();
}; };
function remove_expanded_subjects() {
popovers.hide_topic_sidebar_popover();
$("ul.expanded_subjects").remove();
}
function rebuild_recent_subjects(stream, subject) { function rebuild_recent_subjects(stream, subject) {
// TODO: Call rebuild_recent_subjects less, not on every new // TODO: Call rebuild_recent_subjects less, not on every new
// message. // message.
$('.expanded_subjects').remove(); remove_expanded_subjects();
var max_subjects = 5; var max_subjects = 5;
var stream_li = get_filter_li('stream', stream); var stream_li = get_filter_li('stream', stream);
var subjects = recent_subjects.get(stream) || []; var subjects = recent_subjects.get(stream) || [];
@ -295,7 +300,7 @@ exports.update_dom_with_unread_counts = function (counts) {
$(function () { $(function () {
$(document).on('narrow_activated.zulip', function (event) { $(document).on('narrow_activated.zulip', function (event) {
$("ul.filters li").removeClass('active-filter active-subject-filter'); $("ul.filters li").removeClass('active-filter active-subject-filter');
$('.expanded_subjects').remove(); remove_expanded_subjects();
// TODO: handle confused filters like "in:all stream:foo" // TODO: handle confused filters like "in:all stream:foo"
var op_in = event.filter.operands('in'); var op_in = event.filter.operands('in');
@ -331,7 +336,7 @@ $(function () {
$(document).on('narrow_deactivated.zulip', function (event) { $(document).on('narrow_deactivated.zulip', function (event) {
$("ul.filters li").removeClass('active-filter active-subject-filter'); $("ul.filters li").removeClass('active-filter active-subject-filter');
$("ul.expanded_subjects").remove(); remove_expanded_subjects();
$("#global_filters li[data-name='home']").addClass('active-filter'); $("#global_filters li[data-name='home']").addClass('active-filter');
}); });

View File

@ -1276,8 +1276,6 @@ $(function () {
ui.change_tab_to('#home'); ui.change_tab_to('#home');
} }
popovers.hide_all();
var stream = $(e.target).parents('ul').attr('data-stream'); var stream = $(e.target).parents('ul').attr('data-stream');
var subject = $(e.target).parents('li').attr('data-name'); var subject = $(e.target).parents('li').attr('data-name');