mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
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:
@@ -313,8 +313,8 @@ exports.unread_topic_counter = (function () {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
per_stream_bucketer.each(function (msgs, topic) {
|
|
||||||
var sub = stream_data.get_sub_by_id(stream_id);
|
var sub = stream_data.get_sub_by_id(stream_id);
|
||||||
|
per_stream_bucketer.each(function (msgs, topic) {
|
||||||
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 = [];
|
||||||
per_stream_bucketer.each(function (msgs, topic) {
|
|
||||||
var sub = stream_data.get_sub_by_id(stream_id);
|
var sub = stream_data.get_sub_by_id(stream_id);
|
||||||
|
per_stream_bucketer.each(function (msgs, topic) {
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user