mirror of https://github.com/zulip/zulip.git
Simplified setting active topic.
The old code was looping through recent_subjects to find the original subject name, but we already have logic in get_subject_filter_li() to be case-insensitive. I tried this with various casings of topics, narrowing to topics, as well as narrowing to a stream (so no active topic) and narrowing to an old topic. (imported from commit 1decde13477cb742fd4bc82798f1afb282182bdf)
This commit is contained in:
parent
6b8013c631
commit
10145c0e83
|
@ -179,22 +179,17 @@ function remove_expanded_subjects() {
|
|||
$("ul.expanded_subjects").remove();
|
||||
}
|
||||
|
||||
function rebuild_recent_subjects(stream, subject) {
|
||||
function rebuild_recent_subjects(stream, active_topic) {
|
||||
// TODO: Call rebuild_recent_subjects less, not on every new
|
||||
// message.
|
||||
remove_expanded_subjects();
|
||||
var max_subjects = 5;
|
||||
var stream_li = get_filter_li('stream', stream);
|
||||
var subjects = recent_subjects.get(stream) || [];
|
||||
var active_orig_subject = subject;
|
||||
|
||||
var display_subjects = [];
|
||||
|
||||
_.each(subjects, function (subject_obj, idx) {
|
||||
if (subject === subject_obj.canon_subject) {
|
||||
active_orig_subject = subject_obj.subject;
|
||||
}
|
||||
|
||||
var num_unread = unread.num_unread_for_subject(stream, subject_obj.canon_subject);
|
||||
|
||||
// Show the most recent subjects, as well as any with unread messages
|
||||
|
@ -214,8 +209,8 @@ function rebuild_recent_subjects(stream, subject) {
|
|||
topic_sidebar_arrow: feature_flags.muting,
|
||||
stream: stream}));
|
||||
|
||||
if (active_orig_subject !== undefined) {
|
||||
get_subject_filter_li(stream, active_orig_subject).addClass('active-subject-filter');
|
||||
if (active_topic) {
|
||||
get_subject_filter_li(stream, active_topic).addClass('active-subject-filter');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue