Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

bucketer: Store bucket_keys in reverse_lookup maps.

Tim Abbott9aabe628ff83
diff --git a/static/js/unread.js b/static/js/unread.js
index 8f58cbe13ac..fbac66d479b 100644
--- a/static/js/unread.js
+++ b/static/js/unread.js
@@ -31,6 +31,7 @@ export const unread_mentions_counter = new Set();
const unread_messages = new Set();
class Bucketer {
+ // Maps item_id => bucket_key for items present in a bucket.
reverse_lookup = new Map();
constructor(options) {
@@ -58,12 +59,13 @@ class Bucketer {
} else {
bucket.add(item_id);
}
- this.reverse_lookup.set(item_id, bucket);
+ this.reverse_lookup.set(item_id, bucket_key);
}
delete(item_id) {
- const bucket = this.reverse_lookup.get(item_id);
- if (bucket) {
+ const bucket_key = this.reverse_lookup.get(item_id);
+ if (bucket_key) {
+ const bucket = this.get_bucket(bucket_key);
bucket.delete(item_id);
this.reverse_lookup.delete(item_id);
}