mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
Add unread.get_msg_ids_for_private().
This commit is contained in:
@@ -405,7 +405,7 @@ stream_data.get_stream_id = function () {
|
||||
assert.equal(counts.pm_count.get('999'), 0);
|
||||
}());
|
||||
|
||||
(function test_num_unread_for_person() {
|
||||
(function test_private_messages() {
|
||||
var alice = {
|
||||
email: 'alice@example.com',
|
||||
user_id: 101,
|
||||
@@ -425,6 +425,7 @@ stream_data.get_stream_id = function () {
|
||||
assert.deepEqual(unread.get_msg_ids_for_person(alice.user_id), []);
|
||||
assert.deepEqual(unread.get_msg_ids_for_person(bob.user_id), []);
|
||||
assert.deepEqual(unread.get_msg_ids_for_person(), []);
|
||||
assert.deepEqual(unread.get_msg_ids_for_private(), []);
|
||||
|
||||
var message = {
|
||||
id: 15,
|
||||
@@ -443,6 +444,7 @@ stream_data.get_stream_id = function () {
|
||||
|
||||
assert.deepEqual(unread.get_msg_ids_for_person(alice.user_id), [message.id]);
|
||||
assert.deepEqual(unread.get_msg_ids_for_person(bob.user_id), []);
|
||||
assert.deepEqual(unread.get_msg_ids_for_private(), [message.id]);
|
||||
}());
|
||||
|
||||
|
||||
|
||||
@@ -179,7 +179,20 @@ exports.unread_pm_counter = (function () {
|
||||
return bucket.count();
|
||||
};
|
||||
|
||||
self.get_msg_ids = function (user_ids_string) {
|
||||
self.get_msg_ids = function () {
|
||||
var lists = [];
|
||||
|
||||
bucketer.each(function (id_set) {
|
||||
var members = id_set.members();
|
||||
lists.push(members);
|
||||
});
|
||||
|
||||
var ids = [].concat.apply([], lists);
|
||||
|
||||
return util.sorted_ids(ids);
|
||||
};
|
||||
|
||||
self.get_msg_ids_for_person = function (user_ids_string) {
|
||||
if (!user_ids_string) {
|
||||
return [];
|
||||
}
|
||||
@@ -513,7 +526,11 @@ exports.get_msg_ids_for_topic = function (stream_id, subject) {
|
||||
};
|
||||
|
||||
exports.get_msg_ids_for_person = function (user_ids_string) {
|
||||
return exports.unread_pm_counter.get_msg_ids(user_ids_string);
|
||||
return exports.unread_pm_counter.get_msg_ids_for_person(user_ids_string);
|
||||
};
|
||||
|
||||
exports.get_msg_ids_for_private = function () {
|
||||
return exports.unread_pm_counter.get_msg_ids();
|
||||
};
|
||||
|
||||
exports.load_server_counts = function () {
|
||||
|
||||
Reference in New Issue
Block a user