mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
Rename recent_subjects to recent_topics.
This commit is contained in:
@@ -7,17 +7,17 @@ var exports = {};
|
|||||||
// Call clear_subscriptions() to initialize it.
|
// Call clear_subscriptions() to initialize it.
|
||||||
var stream_info;
|
var stream_info;
|
||||||
var subs_by_stream_id;
|
var subs_by_stream_id;
|
||||||
|
var recent_topics = new Dict({fold_case: true});
|
||||||
|
|
||||||
exports.clear_subscriptions = function () {
|
exports.clear_subscriptions = function () {
|
||||||
stream_info = new Dict({fold_case: true});
|
stream_info = new Dict({fold_case: true});
|
||||||
subs_by_stream_id = new Dict();
|
subs_by_stream_id = new Dict();
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.recent_subjects = new Dict({fold_case: true});
|
|
||||||
exports.clear_subscriptions();
|
exports.clear_subscriptions();
|
||||||
|
|
||||||
exports.is_active = function (stream_name) {
|
exports.is_active = function (stream_name) {
|
||||||
return exports.recent_subjects.has(stream_name);
|
return recent_topics.has(stream_name);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.add_sub = function (stream_name, sub) {
|
exports.add_sub = function (stream_name, sub) {
|
||||||
@@ -236,10 +236,10 @@ exports.process_message_for_recent_topics = function process_message_for_recent_
|
|||||||
var stream = message.stream;
|
var stream = message.stream;
|
||||||
var canon_subject = exports.canonicalized_name(message.subject);
|
var canon_subject = exports.canonicalized_name(message.subject);
|
||||||
|
|
||||||
if (! exports.recent_subjects.has(stream)) {
|
if (! recent_topics.has(stream)) {
|
||||||
exports.recent_subjects.set(stream, []);
|
recent_topics.set(stream, []);
|
||||||
} else {
|
} else {
|
||||||
exports.recent_subjects.set(stream, _.filter(exports.recent_subjects.get(stream), function (item) {
|
recent_topics.set(stream, _.filter(recent_topics.get(stream), function (item) {
|
||||||
var is_duplicate = (item.canon_subject.toLowerCase() === canon_subject.toLowerCase());
|
var is_duplicate = (item.canon_subject.toLowerCase() === canon_subject.toLowerCase());
|
||||||
if (is_duplicate) {
|
if (is_duplicate) {
|
||||||
current_timestamp = item.timestamp;
|
current_timestamp = item.timestamp;
|
||||||
@@ -249,7 +249,7 @@ exports.process_message_for_recent_topics = function process_message_for_recent_
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
var recents = exports.recent_subjects.get(stream);
|
var recents = recent_topics.get(stream);
|
||||||
|
|
||||||
if (remove_message !== undefined) {
|
if (remove_message !== undefined) {
|
||||||
count = count - 1;
|
count = count - 1;
|
||||||
@@ -268,7 +268,7 @@ exports.process_message_for_recent_topics = function process_message_for_recent_
|
|||||||
return b.timestamp - a.timestamp;
|
return b.timestamp - a.timestamp;
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.recent_subjects.set(stream, recents);
|
recent_topics.set(stream, recents);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.get_streams_for_settings_page = function () {
|
exports.get_streams_for_settings_page = function () {
|
||||||
@@ -325,12 +325,12 @@ exports.initialize_from_page_params = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.get_recent_topics = function (stream_name) {
|
exports.get_recent_topics = function (stream_name) {
|
||||||
return exports.recent_subjects.get(stream_name);
|
return recent_topics.get(stream_name);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.populate_stream_topics_for_tests = function (stream_map) {
|
exports.populate_stream_topics_for_tests = function (stream_map) {
|
||||||
// This is only used by tests.
|
// This is only used by tests.
|
||||||
exports.recent_subjects = new Dict.from(stream_map, {fold_case: true});
|
recent_topics = new Dict.from(stream_map, {fold_case: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
|
|||||||
Reference in New Issue
Block a user