diff --git a/frontend_tests/node_tests/narrow_unread.js b/frontend_tests/node_tests/narrow_unread.js index d527b76e6b..67a4651166 100644 --- a/frontend_tests/node_tests/narrow_unread.js +++ b/frontend_tests/node_tests/narrow_unread.js @@ -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, []); }()); diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.js index 62e0fceef6..6eb1a4c815 100644 --- a/frontend_tests/node_tests/unread.js +++ b/frontend_tests/node_tests/unread.js @@ -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, diff --git a/static/js/narrow_state.js b/static/js/narrow_state.js index 6456376d21..9a93a07b61 100644 --- a/static/js/narrow_state.js +++ b/static/js/narrow_state.js @@ -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; }; diff --git a/static/js/unread.js b/static/js/unread.js index c7be0682e5..ebbdc9f8b4 100644 --- a/static/js/unread.js +++ b/static/js/unread.js @@ -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;