mirror of https://github.com/zulip/zulip.git
Add unread.get_all_msg_ids().
This commit is contained in:
parent
073ecaac66
commit
6ca145b2ed
|
@ -91,6 +91,7 @@ var zero_counts = {
|
||||||
|
|
||||||
unread.process_loaded_messages([message, other_message]);
|
unread.process_loaded_messages([message, other_message]);
|
||||||
|
|
||||||
|
assert.deepEqual(unread.get_all_msg_ids(), [15, 16]);
|
||||||
assert.deepEqual(unread.get_unread_message_ids([15, 16]), [15, 16]);
|
assert.deepEqual(unread.get_unread_message_ids([15, 16]), [15, 16]);
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
unread.get_unread_messages([message, other_message]),
|
unread.get_unread_messages([message, other_message]),
|
||||||
|
@ -235,6 +236,9 @@ stream_data.get_stream_id = function () {
|
||||||
assert.equal(unread.num_unread_for_stream(stream_id), 0);
|
assert.equal(unread.num_unread_for_stream(stream_id), 0);
|
||||||
assert.deepEqual(unread.get_msg_ids_for_stream(stream_id), []);
|
assert.deepEqual(unread.get_msg_ids_for_stream(stream_id), []);
|
||||||
|
|
||||||
|
// we still find the message id here (muting is ignored)
|
||||||
|
assert.deepEqual(unread.get_all_msg_ids(), [message.id]);
|
||||||
|
|
||||||
assert.equal(unread.num_unread_for_stream(unknown_stream_id), 0);
|
assert.equal(unread.num_unread_for_stream(unknown_stream_id), 0);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
@ -445,6 +449,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(alice.user_id), [message.id]);
|
||||||
assert.deepEqual(unread.get_msg_ids_for_person(bob.user_id), []);
|
assert.deepEqual(unread.get_msg_ids_for_person(bob.user_id), []);
|
||||||
assert.deepEqual(unread.get_msg_ids_for_private(), [message.id]);
|
assert.deepEqual(unread.get_msg_ids_for_private(), [message.id]);
|
||||||
|
assert.deepEqual(unread.get_all_msg_ids(), [message.id]);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
@ -474,6 +479,7 @@ stream_data.get_stream_id = function () {
|
||||||
counts = unread.get_counts();
|
counts = unread.get_counts();
|
||||||
assert.equal(counts.mentioned_message_count, 1);
|
assert.equal(counts.mentioned_message_count, 1);
|
||||||
assert.deepEqual(unread.get_msg_ids_for_mentions(), [message.id]);
|
assert.deepEqual(unread.get_msg_ids_for_mentions(), [message.id]);
|
||||||
|
assert.deepEqual(unread.get_all_msg_ids(), [message.id]);
|
||||||
unread.mark_as_read(message.id);
|
unread.mark_as_read(message.id);
|
||||||
counts = unread.get_counts();
|
counts = unread.get_counts();
|
||||||
assert.equal(counts.mentioned_message_count, 0);
|
assert.equal(counts.mentioned_message_count, 0);
|
||||||
|
@ -573,6 +579,7 @@ stream_data.get_stream_id = function () {
|
||||||
|
|
||||||
msg_ids = unread.get_msg_ids_for_stream(stream_id);
|
msg_ids = unread.get_msg_ids_for_stream(stream_id);
|
||||||
assert.deepEqual(msg_ids, []);
|
assert.deepEqual(msg_ids, []);
|
||||||
|
assert.deepEqual(unread.get_all_msg_ids(), []);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
(function test_errors() {
|
(function test_errors() {
|
||||||
|
|
|
@ -539,6 +539,12 @@ exports.get_msg_ids_for_mentions = function () {
|
||||||
return util.sorted_ids(ids);
|
return util.sorted_ids(ids);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.get_all_msg_ids = function () {
|
||||||
|
var ids = unread_messages.members();
|
||||||
|
|
||||||
|
return util.sorted_ids(ids);
|
||||||
|
};
|
||||||
|
|
||||||
exports.get_msg_ids_for_starred = function () {
|
exports.get_msg_ids_for_starred = function () {
|
||||||
// This is here for API consistency sake--we never
|
// This is here for API consistency sake--we never
|
||||||
// have unread starred messages. (Some day we may ironically
|
// have unread starred messages. (Some day we may ironically
|
||||||
|
|
Loading…
Reference in New Issue