Zulip 服务器和 Web 应用程序。开源团队聊天可帮助团队保持高效和专注。
Go to file
Steve Howell 5a826040d8 Clean up code for unread counts and notifications.
The core simplification here is that zephyr.js no longer has:

  * the global home_unread_messages
  * the function unread_in_current_view() [which used the global]

The logic that used to be in zephyr is now in its proper home
of unread.js, which has these changes:

  * the structure returned from unread.get_counts() includes
    a new member called unread_in_current_view
  * there's a helper function unread.num_unread_current_messages()

Deprecating zephyr.unread_in_current_view() affected two callers:

 * notifications.update_title_count()
 * notifications_bar.update()

The above functions used to call back to zephyr to get counts, but
there was no nice way to enforce that they were getting counts
at the right time in the code flow, because they depended on
functions like process_visible_unread_messages() to orchestrate
updating internal unread counts before pushing out counts to the DOM.

Now both of those function take a parameter with the unread count,
and we then had to change all of their callers appropriately. This
went hand in hand with another goal, which is that we want all the
unread-counts logic to funnel though basically one place, which
is zephyr.update_unread_counts().  So now that function always
calls notifications_bar.update() [NEW] as well as calling into
the modules unread.js, stream_list.js, and notifications.js [OLD].

Adding the call to notifications_bar.update() in update_unread_counts()
made it so that some other places in the code no longer needed to call
notifications_bar.update(), so you'll see some lines of code
removed.  There are also cases where notifications.update_title_count()
was called redundantly, since the callers were already reaching
update_unread_counts() via other calls.

Finally, in ui.resizehandler, you'll see a simple case where the call
to notifications_bar.update() is preceded by an explicit call
to unread.get_counts().

(imported from commit ce84b9c8076c1f9bb20a61209913f0cb0dae098c)
2013-06-05 17:47:34 -04:00
api [api version bump] Update API documentation in the example scripts 2013-06-05 17:34:41 -04:00
assets favicon: Add an 'infinite' favicon for more than 99 messages 2013-02-15 16:18:24 -05:00
bots Move check_send_receive.py to the naigos plugins directory, renaming it. 2013-05-29 15:36:47 -04:00
certs [manual] Include SSL certificate for wildcard humbughq.com and corresponding chains. 2013-05-29 15:36:47 -04:00
confirmation Wrap render_to_response 2013-05-21 17:56:49 -04:00
humbug Add a TESTING_DEPLOYED settings key, and don't send stats for it 2013-06-05 12:57:47 -04:00
node_modules Import Handlebars compiler and dependencies 2013-04-02 14:43:58 -04:00
servers nagios: Don't page about load/disk/ levels on non-critical servers. 2013-06-05 10:20:56 -04:00
templates [api version bump] Update API documentation in the example scripts 2013-06-05 17:34:41 -04:00
tools Move the current deployment symlink in restart-server 2013-06-05 16:33:43 -04:00
zephyr Clean up code for unread counts and notifications. 2013-06-05 17:47:34 -04:00
.gitignore Update .gitignore for Kdevelop users 2013-06-05 15:38:16 -04:00
manage.py Make manage.py spit out tracebacks, without a patched django 2013-05-28 19:05:06 -04:00