Handle subscription events in the web client

This has the nice side effect of not requiring us to trigger the
events manually in the success callbacks of our subscribe/unsubscribe
ajax calls.

(imported from commit e8d9970b708e9832d22be4803570071bacb46792)
This commit is contained in:
Zev Benjamin
2013-03-29 15:49:05 -04:00
parent 73af933f1f
commit ee9f040040
2 changed files with 12 additions and 15 deletions

View File

@@ -675,6 +675,15 @@ function get_updates(options) {
}
typeahead_helper.autocomplete_needs_update(true);
break;
case 'subscription':
if (event.op === 'add') {
$(document).trigger($.Event('subscription_add.zephyr',
{subscription: event.subscription}));
} else if (event.op === 'remove') {
$(document).trigger($.Event('subscription_remove.zephyr',
{subscription: event.subscription}));
}
break;
}
});