mirror of https://github.com/zulip/zulip.git
minor: Pull statements out of loops in unread.js.
We were recalculating the same sub for every iteration in these two loops. It's a pretty fast operation but still nice to do only one time.
This commit is contained in:
parent
0c9cf12933
commit
b5904b264d
|
@ -313,8 +313,8 @@ exports.unread_topic_counter = (function () {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sub = stream_data.get_sub_by_id(stream_id);
|
||||||
per_stream_bucketer.each(function (msgs, topic) {
|
per_stream_bucketer.each(function (msgs, topic) {
|
||||||
var sub = stream_data.get_sub_by_id(stream_id);
|
|
||||||
if (sub && !muting.is_topic_muted(sub.name, topic)) {
|
if (sub && !muting.is_topic_muted(sub.name, topic)) {
|
||||||
stream_count += msgs.count();
|
stream_count += msgs.count();
|
||||||
}
|
}
|
||||||
|
@ -345,8 +345,8 @@ exports.unread_topic_counter = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
var topic_lists = [];
|
var topic_lists = [];
|
||||||
|
var sub = stream_data.get_sub_by_id(stream_id);
|
||||||
per_stream_bucketer.each(function (msgs, topic) {
|
per_stream_bucketer.each(function (msgs, topic) {
|
||||||
var sub = stream_data.get_sub_by_id(stream_id);
|
|
||||||
if (sub && !muting.is_topic_muted(sub.name, topic)) {
|
if (sub && !muting.is_topic_muted(sub.name, topic)) {
|
||||||
topic_lists.push(msgs.members());
|
topic_lists.push(msgs.members());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue