The setdefault() and num_items() methods are handy, and it was a
little tough to keep track of which objects were Dicts vs. {}.
(imported from commit 6ca81ac411943c59bef6d6bae39c7641feb5574b)
Have ui.set_presence_list() only touch the presence list.
Before this change, it was calling update_unread_counts(), which
has a bunch of side effects unrelated to the presence list.
(imported from commit 690f754d78874a03fa36f8ff8765d5a63e431d28)
We had a duplicate and incorrect check on if a stream was in your home
view, which caused us to not display Home unread counts in the sidebar
/ notification bar / Dock on page load.
(imported from commit db27cf9091f8b47200b025f03a26c4fe82701882)
There are also one or two places we don't need to use it for security
purposes, but we do so for consistencey.
(imported from commit aa111f5a22a0e8597ec3cf8504adae66d5fb6768)
This covers most of the module's functionality, with special
emphasis on lines that use underscore.js (_.each and _.filter).
(imported from commit 074181a0273286a258504be634bdd1cead2eecd5)