mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
This commit was originally automatically generated using `tools/lint --only=eslint --fix`. It was then modified by tabbott to contain only changes to a set of files that are unlikely to result in significant merge conflicts with any open pull request, excluding about 20 files. His plan is to merge the remaining changes with more precise care, potentially involving merging parts of conflicting pull requests before running the `eslint --fix` operation. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
49 lines
1005 B
JavaScript
49 lines
1005 B
JavaScript
const Dict = require('./dict').Dict;
|
|
|
|
exports.ids = new Dict();
|
|
|
|
exports.initialize = function () {
|
|
exports.ids = new Dict();
|
|
_.each(page_params.starred_messages, function (id) {
|
|
exports.ids.set(id, true);
|
|
});
|
|
exports.rerender_ui();
|
|
};
|
|
|
|
exports.add = function (ids) {
|
|
_.each(ids, function (id) {
|
|
exports.ids.set(id, true);
|
|
});
|
|
exports.rerender_ui();
|
|
};
|
|
|
|
exports.remove = function (ids) {
|
|
_.each(ids, function (id) {
|
|
if (exports.ids.has(id)) {
|
|
exports.ids.del(id);
|
|
}
|
|
});
|
|
exports.rerender_ui();
|
|
};
|
|
|
|
exports.count = function () {
|
|
return exports.ids.num_items();
|
|
};
|
|
|
|
exports.get_starred_msg_ids = function () {
|
|
return exports.ids.keys();
|
|
};
|
|
|
|
exports.rerender_ui = function () {
|
|
let count = exports.count();
|
|
|
|
if (!page_params.starred_message_counts) {
|
|
// This essentially hides the count
|
|
count = 0;
|
|
}
|
|
|
|
top_left_corner.update_starred_count(count);
|
|
};
|
|
|
|
window.starred_messages = exports;
|