mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 20:41:46 +00:00
Add starred messages to our new API for unread ids.
Even though starred messages are never unread, it's useful for us to have helper functions for them. This change makes it so that clicking on "Starred Messages" takes you to the last read message immediately, without a server delay.
This commit is contained in:
@@ -143,4 +143,11 @@ function assert_unread_info(expected) {
|
||||
blueslip.set_test_data('warn', 'Unknown emails: bob@example.com');
|
||||
unread_ids = narrow_state.get_unread_ids();
|
||||
assert.deepEqual(unread_ids, []);
|
||||
|
||||
terms = [
|
||||
{operator: 'is', operand: 'starred'},
|
||||
];
|
||||
set_filter(terms);
|
||||
unread_ids = narrow_state.get_unread_ids();
|
||||
assert.deepEqual(unread_ids, []);
|
||||
}());
|
||||
|
||||
@@ -479,6 +479,12 @@ stream_data.get_stream_id = function () {
|
||||
assert.equal(counts.mentioned_message_count, 0);
|
||||
}());
|
||||
|
||||
(function test_starring() {
|
||||
// We don't need any setup here, because we just hard code
|
||||
// this to [] in the code.
|
||||
assert.deepEqual(unread.get_msg_ids_for_starred(), []);
|
||||
}());
|
||||
|
||||
(function test_declare_bankruptcy() {
|
||||
var message = {
|
||||
id: 16,
|
||||
|
||||
@@ -236,6 +236,10 @@ exports.get_unread_ids = function () {
|
||||
return unread.get_msg_ids_for_mentions();
|
||||
}
|
||||
|
||||
if (current_filter.is_for_only('starred')) {
|
||||
return unread.get_msg_ids_for_starred();
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
@@ -539,6 +539,14 @@ exports.get_msg_ids_for_mentions = function () {
|
||||
return util.sorted_ids(ids);
|
||||
};
|
||||
|
||||
exports.get_msg_ids_for_starred = function () {
|
||||
// This is here for API consistency sake--we never
|
||||
// have unread starred messages. (Some day we may ironically
|
||||
// want to make starring the same as mark-as-unread, but
|
||||
// for now starring === reading.)
|
||||
return [];
|
||||
};
|
||||
|
||||
exports.load_server_counts = function () {
|
||||
var unread_msgs = page_params.unread_msgs;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user