diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.js index 27c7af1913..62e0fceef6 100644 --- a/frontend_tests/node_tests/unread.js +++ b/frontend_tests/node_tests/unread.js @@ -458,6 +458,7 @@ stream_data.get_stream_id = function () { var counts = unread.get_counts(); assert.equal(counts.mentioned_message_count, 0); + assert.deepEqual(unread.get_msg_ids_for_mentions(), []); var message = { id: 15, @@ -472,6 +473,7 @@ stream_data.get_stream_id = function () { counts = unread.get_counts(); assert.equal(counts.mentioned_message_count, 1); + assert.deepEqual(unread.get_msg_ids_for_mentions(), [message.id]); unread.mark_as_read(message.id); counts = unread.get_counts(); assert.equal(counts.mentioned_message_count, 0); diff --git a/static/js/unread.js b/static/js/unread.js index 900f4a113e..c7be0682e5 100644 --- a/static/js/unread.js +++ b/static/js/unread.js @@ -533,6 +533,12 @@ exports.get_msg_ids_for_private = function () { return exports.unread_pm_counter.get_msg_ids(); }; +exports.get_msg_ids_for_mentions = function () { + var ids = exports.unread_mentions_counter.members(); + + return util.sorted_ids(ids); +}; + exports.load_server_counts = function () { var unread_msgs = page_params.unread_msgs;