mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 20:41:46 +00:00
Add unread.get_msg_ids_for_stream().
This commit is contained in:
@@ -309,6 +309,26 @@ exports.unread_topic_counter = (function () {
|
||||
return topic_bucket.count();
|
||||
};
|
||||
|
||||
self.get_msg_ids_for_stream = function (stream_id) {
|
||||
var per_stream_bucketer = bucketer.get_bucket(stream_id);
|
||||
|
||||
if (!per_stream_bucketer) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var topic_lists = [];
|
||||
per_stream_bucketer.each(function (msgs, topic) {
|
||||
var sub = stream_data.get_sub_by_id(stream_id);
|
||||
if (sub && !muting.is_topic_muted(sub.name, topic)) {
|
||||
topic_lists.push(msgs.members());
|
||||
}
|
||||
});
|
||||
|
||||
var ids = [].concat.apply([], topic_lists);
|
||||
|
||||
return util.sorted_ids(ids);
|
||||
};
|
||||
|
||||
self.get_msg_ids_for_topic = function (stream_id, topic) {
|
||||
var per_stream_bucketer = bucketer.get_bucket(stream_id);
|
||||
if (!per_stream_bucketer) {
|
||||
@@ -469,6 +489,10 @@ exports.num_unread_for_person = function (user_ids_string) {
|
||||
return exports.unread_pm_counter.num_unread(user_ids_string);
|
||||
};
|
||||
|
||||
exports.get_msg_ids_for_stream = function (stream_id) {
|
||||
return exports.unread_topic_counter.get_msg_ids_for_stream(stream_id);
|
||||
};
|
||||
|
||||
exports.get_msg_ids_for_topic = function (stream_id, subject) {
|
||||
return exports.unread_topic_counter.get_msg_ids_for_topic(stream_id, subject);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user