subscription: Add real time sync for user-just-deactivated case.

Currently, stream subscriptions aren't getting updated without
hard reload when user is deactivated in realm.

Fix this issue by updating stream subscription widgets on user
deactivation event.

Fixes #5623
This commit is contained in:
YJDave
2018-03-25 18:23:01 +05:30
committed by Tim Abbott
parent cf40536ed2
commit 24f51739eb
4 changed files with 18 additions and 0 deletions

View File

@@ -349,6 +349,16 @@ exports.add_subscriber = function (stream_name, user_id) {
return true;
};
exports.remove_deactivated_user_from_all_streams = function (user_id) {
(stream_info.values()).forEach(function (stream) {
if (exports.is_user_subscribed(stream.name, user_id)) {
exports.remove_subscriber(stream.name, user_id);
var sub = exports.get_sub(stream.name);
subs.rerender_subscriptions_settings(sub);
}
});
};
exports.remove_subscriber = function (stream_name, user_id) {
var sub = exports.get_sub(stream_name);
if (typeof sub === 'undefined') {