mirror of https://github.com/zulip/zulip.git
Fire events during different stages of subs.js subscription management
We now fire three events: * subscription_add_done - fired when subs.js has finished handling a subscription_add event (all structures are set up, etc.) * subscription_remove_done - fired when subs.js has finished handling a subscription_remove event * sub_obj_created - fired when subs.js has created a sub object. This happens both when a new subscription is added and at page startup for all existing subscriptions These events are fired whenever sub objects are created, even when not tied to a subscription event. (imported from commit a4863451f37e7fdbad480696b388ea788b01d6b9)
This commit is contained in:
parent
dc82d60c13
commit
ceac6b0613
|
@ -240,6 +240,7 @@ function create_sub(stream_name, attrs) {
|
|||
mark_color_used(sub.color);
|
||||
|
||||
add_sub(stream_name, sub);
|
||||
$(document).trigger($.Event('sub_obj_created.zephyr', {sub: sub}));
|
||||
if (sub.subscribed) {
|
||||
ui.add_narrow_filter(stream_name, "stream");
|
||||
}
|
||||
|
@ -322,6 +323,8 @@ function mark_subscribed(stream_name, attrs) {
|
|||
ui.sort_narrow_list();
|
||||
|
||||
typeahead_helper.update_autocomplete();
|
||||
|
||||
$(document).trigger($.Event('subscription_add_done.zephyr', {sub: sub}));
|
||||
}
|
||||
|
||||
function mark_unsubscribed(stream_name) {
|
||||
|
@ -359,6 +362,8 @@ function mark_unsubscribed(stream_name) {
|
|||
}
|
||||
|
||||
typeahead_helper.update_autocomplete();
|
||||
|
||||
$(document).trigger($.Event('subscription_remove_done.zephyr', {sub: sub}));
|
||||
}
|
||||
|
||||
$(function () {
|
||||
|
|
Loading…
Reference in New Issue