From 3d8ce28964f818fee950451d817bc712973ff207 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Fri, 26 Jul 2013 18:41:19 -0400 Subject: [PATCH] Use underscore in unread.js (imported from commit 91befaaaff5d9a791a3c1bb4ff99f4085c27c4cb) --- static/js/unread.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/static/js/unread.js b/static/js/unread.js index 6ae381ad0c..acdde10155 100644 --- a/static/js/unread.js +++ b/static/js/unread.js @@ -64,7 +64,7 @@ exports.update_unread_subjects = function (msg, event) { }; exports.process_loaded_messages = function (messages) { - $.each(messages, function (idx, message) { + _.each(messages, function (message) { var unread = exports.message_unread(message); if (!unread) { return; @@ -102,7 +102,7 @@ exports.declare_bankruptcy = function () { exports.num_unread_current_messages = function () { var num_unread = 0; - $.each(current_msg_list.all(), function (idx, msg) { + _.each(current_msg_list.all(), function (msg) { if ((msg.id > current_msg_list.selected_id()) && exports.message_unread(msg)) { num_unread += 1; } @@ -125,12 +125,12 @@ exports.get_counts = function () { res.pm_count = {}; // Hash by email -> count function only_in_home_view(msgids) { - return $.grep(msgids, function (msgid) { + return _.filter(msgids, function (msgid) { return home_msg_list.get(msgid) !== undefined; }); } - $.each(unread_counts.stream, function (stream, msgs) { + _.each(unread_counts.stream, function (msgs, stream) { if (! subs.is_subscribed(stream)) { return true; } @@ -144,7 +144,7 @@ exports.get_counts = function () { if (unread_subjects[stream] !== undefined) { res.subject_count[stream] = {}; - $.each(unread_subjects[stream], function (subject, msgs) { + _.each(unread_subjects[stream], function (msgs, subject) { res.subject_count[stream][subject] = Object.keys(msgs).length; }); } @@ -152,7 +152,7 @@ exports.get_counts = function () { }); var pm_count = 0; - $.each(unread_counts["private"], function (index, obj) { + _.each(unread_counts["private"], function (obj, index) { var count = Object.keys(obj).length; res.pm_count[index] = count; pm_count += count;