2017-05-31 08:53:09 +02:00
|
|
|
var server_events_dispatch = (function () {
|
|
|
|
|
|
|
|
var exports = {};
|
|
|
|
|
|
|
|
exports.dispatch_normal_event = function dispatch_normal_event(event) {
|
2017-07-18 02:58:13 +02:00
|
|
|
var noop = function () {};
|
2017-05-31 08:53:09 +02:00
|
|
|
switch (event.type) {
|
|
|
|
case 'alert_words':
|
|
|
|
alert_words.words = event.alert_words;
|
2017-06-11 20:30:09 +02:00
|
|
|
alert_words_ui.render_alert_words_ui();
|
2017-05-31 08:53:09 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'default_streams':
|
2017-08-22 18:20:00 +02:00
|
|
|
stream_data.set_realm_default_streams(event.default_streams);
|
2017-05-31 08:53:09 +02:00
|
|
|
settings_streams.update_default_streams_table();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'hotspots':
|
2017-07-14 03:21:30 +02:00
|
|
|
hotspots.load_new(event.hotspots);
|
|
|
|
page_params.hotspots = page_params.hotspots ?
|
|
|
|
page_params.hotspots.concat(event.hotspots) :
|
|
|
|
event.hotspots;
|
2017-05-31 08:53:09 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'muted_topics':
|
|
|
|
muting_ui.handle_updates(event.muted_topics);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'presence':
|
|
|
|
activity.set_user_status(event.email, event.presence, event.server_timestamp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'restart':
|
|
|
|
var reload_options = {save_pointer: true,
|
|
|
|
save_narrow: true,
|
|
|
|
save_compose: true,
|
|
|
|
message: "The application has been updated; reloading!",
|
|
|
|
};
|
|
|
|
if (event.immediate) {
|
|
|
|
reload_options.immediate = true;
|
|
|
|
}
|
|
|
|
reload.initiate(reload_options);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'reaction':
|
|
|
|
if (event.op === 'add') {
|
|
|
|
reactions.add_reaction(event);
|
|
|
|
} else if (event.op === 'remove') {
|
|
|
|
reactions.remove_reaction(event);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'realm':
|
2017-07-18 02:58:13 +02:00
|
|
|
var realm_settings = {
|
|
|
|
add_emoji_by_admins_only: settings_emoji.update_custom_emoji_ui,
|
|
|
|
allow_edit_history: noop,
|
2017-11-08 13:40:46 +01:00
|
|
|
allow_message_deleting: noop,
|
2017-08-20 03:08:53 +02:00
|
|
|
allow_message_editing: noop,
|
2018-04-21 19:30:32 +02:00
|
|
|
allow_community_topic_editing: noop,
|
2018-01-29 16:10:54 +01:00
|
|
|
bot_creation_policy: settings_bots.update_bot_permissions_ui,
|
2017-07-18 02:58:13 +02:00
|
|
|
create_stream_by_admins_only: noop,
|
2018-03-30 19:47:27 +02:00
|
|
|
default_language: noop,
|
2018-03-30 22:38:16 +02:00
|
|
|
default_twenty_four_hour_time: noop,
|
2018-03-30 19:47:27 +02:00
|
|
|
description: noop,
|
2018-03-02 21:44:14 +01:00
|
|
|
email_changes_disabled: settings_account.update_email_change_display,
|
2018-03-05 19:19:19 +01:00
|
|
|
disallow_disposable_email_addresses: noop,
|
2018-04-23 14:51:30 +02:00
|
|
|
google_hangouts_domain: noop,
|
2017-07-18 02:58:13 +02:00
|
|
|
inline_image_preview: noop,
|
|
|
|
inline_url_embed_preview: noop,
|
|
|
|
invite_by_admins_only: noop,
|
|
|
|
invite_required: noop,
|
|
|
|
mandatory_topics: noop,
|
2018-03-25 15:35:10 +02:00
|
|
|
message_content_edit_limit_seconds: noop,
|
2017-11-26 09:12:10 +01:00
|
|
|
message_content_delete_limit_seconds: noop,
|
2018-03-30 19:47:27 +02:00
|
|
|
message_retention_days: noop,
|
2017-07-18 02:58:13 +02:00
|
|
|
name: notifications.redraw_title,
|
2018-03-02 21:44:14 +01:00
|
|
|
name_changes_disabled: settings_account.update_name_change_display,
|
2017-07-18 02:58:13 +02:00
|
|
|
notifications_stream_id: noop,
|
2018-02-18 09:34:54 +01:00
|
|
|
send_welcome_emails: noop,
|
2017-10-20 16:55:04 +02:00
|
|
|
signup_notifications_stream_id: noop,
|
2017-07-18 02:58:13 +02:00
|
|
|
restricted_to_domain: noop,
|
2018-04-23 14:51:30 +02:00
|
|
|
video_chat_provider: noop,
|
2017-07-18 02:58:13 +02:00
|
|
|
waiting_period_threshold: noop,
|
|
|
|
};
|
|
|
|
if (event.op === 'update' && _.has(realm_settings, event.property)) {
|
|
|
|
page_params['realm_' + event.property] = event.value;
|
|
|
|
realm_settings[event.property]();
|
2018-03-25 15:35:10 +02:00
|
|
|
settings_org.sync_realm_settings(event.property);
|
2017-07-19 23:45:53 +02:00
|
|
|
if (event.property === 'create_stream_by_admins_only') {
|
2017-07-18 02:58:13 +02:00
|
|
|
if (!page_params.is_admin) {
|
|
|
|
page_params.can_create_streams = (!page_params.
|
|
|
|
realm_create_stream_by_admins_only);
|
|
|
|
}
|
|
|
|
} else if (event.property === 'notifications_stream_id') {
|
|
|
|
settings_org.render_notifications_stream_ui(
|
2018-03-31 03:08:33 +02:00
|
|
|
page_params.realm_notifications_stream_id,
|
|
|
|
$('#realm_notifications_stream_name'));
|
2017-10-20 16:55:04 +02:00
|
|
|
} else if (event.property === 'signup_notifications_stream_id') {
|
2018-03-31 03:44:07 +02:00
|
|
|
settings_org.render_notifications_stream_ui(
|
|
|
|
page_params.realm_signup_notifications_stream_id,
|
|
|
|
$('#realm_signup_notifications_stream_name'));
|
2017-05-31 08:53:09 +02:00
|
|
|
}
|
2018-03-20 18:30:25 +01:00
|
|
|
|
|
|
|
if (event.property === 'name' && window.electron_bridge !== undefined) {
|
|
|
|
window.electron_bridge.send_event('realm_name', event.value);
|
|
|
|
}
|
2017-05-31 08:53:09 +02:00
|
|
|
} else if (event.op === 'update_dict' && event.property === 'default') {
|
2017-07-01 14:18:03 +02:00
|
|
|
_.each(event.data, function (value, key) {
|
2017-05-31 08:53:09 +02:00
|
|
|
page_params['realm_' + key] = value;
|
2017-08-20 03:08:53 +02:00
|
|
|
if (key === 'allow_message_editing') {
|
2018-03-05 18:28:37 +01:00
|
|
|
message_edit.update_message_topic_editing_pencil();
|
2017-08-20 03:08:53 +02:00
|
|
|
}
|
2018-03-25 15:35:10 +02:00
|
|
|
if (_.has(realm_settings, key)) {
|
|
|
|
settings_org.sync_realm_settings(key);
|
|
|
|
}
|
2017-05-31 08:53:09 +02:00
|
|
|
});
|
|
|
|
if (event.data.authentication_methods !== undefined) {
|
|
|
|
settings_org.populate_auth_methods(event.data.authentication_methods);
|
|
|
|
}
|
|
|
|
} else if (event.op === 'update_dict' && event.property === 'icon') {
|
|
|
|
page_params.realm_icon_url = event.data.icon_url;
|
|
|
|
page_params.realm_icon_source = event.data.icon_source;
|
|
|
|
realm_icon.rerender();
|
2018-03-20 18:28:48 +01:00
|
|
|
|
|
|
|
var electron_bridge = window.electron_bridge;
|
|
|
|
if (electron_bridge !== undefined) {
|
|
|
|
electron_bridge.send_event('realm_icon_url', event.data.icon_url);
|
|
|
|
}
|
2018-01-30 14:58:50 +01:00
|
|
|
} else if (event.op === 'deactivated') {
|
|
|
|
window.location.href = "/accounts/deactivated/";
|
2017-05-31 08:53:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'realm_bot':
|
|
|
|
if (event.op === 'add') {
|
|
|
|
bot_data.add(event.bot);
|
|
|
|
settings_users.update_user_data(event.bot.user_id, event.bot);
|
|
|
|
} else if (event.op === 'remove') {
|
2018-01-22 18:36:53 +01:00
|
|
|
bot_data.deactivate(event.bot.user_id);
|
2017-05-31 08:53:09 +02:00
|
|
|
event.bot.is_active = false;
|
|
|
|
settings_users.update_user_data(event.bot.user_id, event.bot);
|
2018-03-08 16:28:37 +01:00
|
|
|
} else if (event.op === 'delete') {
|
|
|
|
bot_data.delete(event.bot.user_id);
|
|
|
|
settings_users.update_user_data(event.bot.user_id, event.bot);
|
2017-05-31 08:53:09 +02:00
|
|
|
} else if (event.op === 'update') {
|
|
|
|
if (_.has(event.bot, 'owner_id')) {
|
|
|
|
event.bot.owner = people.get_person_from_user_id(event.bot.owner_id).email;
|
|
|
|
}
|
2018-01-22 18:36:53 +01:00
|
|
|
bot_data.update(event.bot.user_id, event.bot);
|
2017-05-31 08:53:09 +02:00
|
|
|
settings_users.update_user_data(event.bot.user_id, event.bot);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'realm_emoji':
|
|
|
|
// Update `page_params.realm_emoji` so that settings page
|
|
|
|
// can display it properly when reopened without refresh.
|
|
|
|
page_params.realm_emoji = event.realm_emoji;
|
|
|
|
emoji.update_emojis(event.realm_emoji);
|
|
|
|
settings_emoji.populate_emoji(event.realm_emoji);
|
2017-07-19 00:28:56 +02:00
|
|
|
emoji_picker.generate_emoji_picker_data(emoji.active_realm_emojis);
|
2017-05-31 08:53:09 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'realm_filters':
|
|
|
|
page_params.realm_filters = event.realm_filters;
|
|
|
|
markdown.set_realm_filters(page_params.realm_filters);
|
|
|
|
settings_filters.populate_filters(page_params.realm_filters);
|
|
|
|
break;
|
|
|
|
|
2017-12-14 05:51:45 +01:00
|
|
|
case 'custom_profile_fields':
|
|
|
|
page_params.custom_profile_fields = event.fields;
|
|
|
|
settings_profile_fields.populate_profile_fields(page_params.custom_profile_fields);
|
|
|
|
break;
|
|
|
|
|
2017-05-31 08:53:09 +02:00
|
|
|
case 'realm_domains':
|
|
|
|
var i;
|
|
|
|
if (event.op === 'add') {
|
|
|
|
page_params.realm_domains.push(event.realm_domain);
|
|
|
|
} else if (event.op === 'change') {
|
|
|
|
for (i = 0; i < page_params.realm_domains.length; i += 1) {
|
|
|
|
if (page_params.realm_domains[i].domain === event.realm_domain.domain) {
|
|
|
|
page_params.realm_domains[i].allow_subdomains =
|
|
|
|
event.realm_domain.allow_subdomains;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (event.op === 'remove') {
|
|
|
|
for (i = 0; i < page_params.realm_domains.length; i += 1) {
|
|
|
|
if (page_params.realm_domains[i].domain === event.domain) {
|
|
|
|
page_params.realm_domains.splice(i, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
settings_org.populate_realm_domains(page_params.realm_domains);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'realm_user':
|
|
|
|
if (event.op === 'add') {
|
|
|
|
people.add_in_realm(event.person);
|
|
|
|
} else if (event.op === 'remove') {
|
|
|
|
people.deactivate(event.person);
|
2018-03-25 14:53:01 +02:00
|
|
|
stream_data.remove_deactivated_user_from_all_streams(event.person.user_id);
|
2017-05-31 08:53:09 +02:00
|
|
|
} else if (event.op === 'update') {
|
|
|
|
user_events.update_person(event.person);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'stream':
|
|
|
|
if (event.op === 'update') {
|
|
|
|
// Legacy: Stream properties are still managed by subs.js on the client side.
|
|
|
|
stream_events.update_property(
|
|
|
|
event.stream_id,
|
|
|
|
event.property,
|
|
|
|
event.value
|
|
|
|
);
|
|
|
|
settings_streams.update_default_streams_table();
|
|
|
|
} else if (event.op === 'create') {
|
|
|
|
stream_data.create_streams(event.streams);
|
2018-02-16 07:19:18 +01:00
|
|
|
_.each(event.streams, function (stream) {
|
|
|
|
var sub = stream_data.get_sub_by_id(stream.stream_id);
|
|
|
|
stream_data.update_calculated_fields(sub);
|
|
|
|
subs.add_sub_to_table(sub);
|
|
|
|
});
|
2017-05-31 08:53:09 +02:00
|
|
|
} else if (event.op === 'delete') {
|
|
|
|
_.each(event.streams, function (stream) {
|
2017-08-22 23:19:18 +02:00
|
|
|
var was_subscribed = stream_data.get_sub_by_id(stream.stream_id).subscribed;
|
|
|
|
stream_data.delete_sub(stream.stream_id);
|
|
|
|
subs.remove_stream(stream.stream_id);
|
|
|
|
if (was_subscribed) {
|
2017-05-31 08:53:09 +02:00
|
|
|
stream_list.remove_sidebar_row(stream.stream_id);
|
|
|
|
}
|
|
|
|
settings_streams.remove_default_stream(stream.stream_id);
|
|
|
|
stream_data.remove_default_stream(stream.stream_id);
|
2017-06-10 07:03:53 +02:00
|
|
|
if (page_params.realm_notifications_stream_id === stream.stream_id) {
|
|
|
|
page_params.realm_notifications_stream_id = -1;
|
|
|
|
settings_org.render_notifications_stream_ui(
|
2018-03-31 03:08:33 +02:00
|
|
|
page_params.realm_notifications_stream_id,
|
|
|
|
$('#realm_notifications_stream_name'));
|
2017-06-10 07:03:53 +02:00
|
|
|
}
|
2017-10-20 16:55:04 +02:00
|
|
|
if (page_params.realm_signup_notifications_stream_id === stream.stream_id) {
|
|
|
|
page_params.realm_signup_notifications_stream_id = -1;
|
2018-03-31 03:44:07 +02:00
|
|
|
settings_org.render_notifications_stream_ui(
|
|
|
|
page_params.realm_signup_notifications_stream_id,
|
|
|
|
$('#realm_signup_notifications_stream_name'));
|
2017-10-20 16:55:04 +02:00
|
|
|
}
|
2017-05-31 08:53:09 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'subscription':
|
|
|
|
if (event.op === 'add') {
|
|
|
|
_.each(event.subscriptions, function (rec) {
|
|
|
|
var sub = stream_data.get_sub_by_id(rec.stream_id);
|
|
|
|
if (sub) {
|
2018-04-05 19:58:27 +02:00
|
|
|
stream_data.update_stream_email_address(sub, rec.email_address);
|
2017-05-31 08:53:09 +02:00
|
|
|
stream_events.mark_subscribed(sub, rec.subscribers);
|
|
|
|
} else {
|
2017-08-16 20:59:49 +02:00
|
|
|
blueslip.error('Subscribing to unknown stream with ID ' + rec.stream_id);
|
2017-05-31 08:53:09 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (event.op === 'peer_add') {
|
|
|
|
_.each(event.subscriptions, function (sub) {
|
|
|
|
if (stream_data.add_subscriber(sub, event.user_id)) {
|
2018-04-08 07:33:49 +02:00
|
|
|
$(document).trigger('peer_subscribe.zulip', {stream_name: sub});
|
2017-05-31 08:53:09 +02:00
|
|
|
} else {
|
|
|
|
blueslip.warn('Cannot process peer_add event');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (event.op === 'peer_remove') {
|
|
|
|
_.each(event.subscriptions, function (sub) {
|
|
|
|
if (stream_data.remove_subscriber(sub, event.user_id)) {
|
2018-04-08 07:33:49 +02:00
|
|
|
$(document).trigger('peer_unsubscribe.zulip', {stream_name: sub});
|
2017-05-31 08:53:09 +02:00
|
|
|
} else {
|
|
|
|
blueslip.warn('Cannot process peer_remove event.');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (event.op === 'remove') {
|
|
|
|
_.each(event.subscriptions, function (rec) {
|
|
|
|
var sub = stream_data.get_sub_by_id(rec.stream_id);
|
|
|
|
stream_events.mark_unsubscribed(sub);
|
|
|
|
});
|
|
|
|
} else if (event.op === 'update') {
|
|
|
|
stream_events.update_property(
|
|
|
|
event.stream_id,
|
|
|
|
event.property,
|
|
|
|
event.value
|
|
|
|
);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'typing':
|
|
|
|
if (event.sender.user_id === page_params.user_id) {
|
|
|
|
// typing notifications are sent to the user who is typing
|
|
|
|
// as well as recipients; we ignore such self-generated events.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (event.op === 'start') {
|
|
|
|
typing_events.display_notification(event);
|
|
|
|
} else if (event.op === 'stop') {
|
|
|
|
typing_events.hide_notification(event);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'update_display_settings':
|
2017-07-18 02:58:13 +02:00
|
|
|
var user_display_settings = [
|
|
|
|
'default_language',
|
|
|
|
'emojiset',
|
|
|
|
'high_contrast_mode',
|
2017-11-14 20:42:31 +01:00
|
|
|
'night_mode',
|
2017-07-18 02:58:13 +02:00
|
|
|
'left_side_userlist',
|
|
|
|
'timezone',
|
|
|
|
'twenty_four_hour_time',
|
2018-01-15 19:36:32 +01:00
|
|
|
'translate_emoticons',
|
2017-07-18 02:58:13 +02:00
|
|
|
];
|
|
|
|
if (_.contains(user_display_settings, event.setting_name)) {
|
|
|
|
page_params[event.setting_name] = event.setting;
|
|
|
|
}
|
2018-03-05 03:46:07 +01:00
|
|
|
if (event.setting_name === 'default_language') {
|
|
|
|
// We additionally need to set the language name.
|
|
|
|
page_params.default_language_name = event.language_name;
|
|
|
|
}
|
2017-05-31 08:53:09 +02:00
|
|
|
if (event.setting_name === 'twenty_four_hour_time') {
|
|
|
|
// Rerender the whole message list UI
|
|
|
|
home_msg_list.rerender();
|
|
|
|
if (current_msg_list === message_list.narrowed) {
|
|
|
|
message_list.narrowed.rerender();
|
|
|
|
}
|
|
|
|
}
|
2017-07-07 18:15:10 +02:00
|
|
|
if (event.setting_name === 'high_contrast_mode') {
|
|
|
|
$("body").toggleClass("high-contrast");
|
|
|
|
}
|
2017-11-14 20:42:31 +01:00
|
|
|
if (event.setting_name === 'night_mode') {
|
|
|
|
$("body").fadeOut(300);
|
|
|
|
setTimeout(function () {
|
2017-11-30 02:31:21 +01:00
|
|
|
if (event.setting === true) {
|
|
|
|
night_mode.enable();
|
|
|
|
} else {
|
|
|
|
night_mode.disable();
|
|
|
|
}
|
2017-11-14 20:42:31 +01:00
|
|
|
$("body").fadeIn(300);
|
|
|
|
}, 300);
|
|
|
|
}
|
2017-05-31 08:53:09 +02:00
|
|
|
if (event.setting_name === 'left_side_userlist') {
|
|
|
|
// TODO: Make this change the view immediately rather
|
|
|
|
// than requiring a reload or page resize.
|
|
|
|
}
|
|
|
|
if (event.setting_name === 'default_language') {
|
|
|
|
// TODO: Make this change the view immediately rather
|
|
|
|
// than requiring a reload or page resize.
|
|
|
|
}
|
|
|
|
if (event.setting_name === 'emojiset') {
|
2018-01-02 21:11:23 +01:00
|
|
|
settings_display.report_emojiset_change();
|
|
|
|
|
2018-01-02 13:02:13 +01:00
|
|
|
// Rerender the whole message list UI
|
|
|
|
home_msg_list.rerender();
|
|
|
|
if (current_msg_list === message_list.narrowed) {
|
|
|
|
message_list.narrowed.rerender();
|
|
|
|
}
|
2017-05-31 08:53:09 +02:00
|
|
|
}
|
2018-03-05 03:32:05 +01:00
|
|
|
settings_display.update_page();
|
2017-05-31 08:53:09 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'update_global_notifications':
|
|
|
|
notifications.handle_global_notification_updates(event.notification_name,
|
|
|
|
event.setting);
|
2018-03-06 20:51:43 +01:00
|
|
|
settings_notifications.update_page();
|
2017-05-31 08:53:09 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'update_message_flags':
|
|
|
|
var new_value = event.operation === "add";
|
|
|
|
switch (event.flag) {
|
|
|
|
case 'starred':
|
|
|
|
_.each(event.messages, function (message_id) {
|
|
|
|
ui.update_starred(message_id, new_value);
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 'read':
|
2017-08-03 00:28:16 +02:00
|
|
|
unread_ops.process_read_messages_event(event.messages);
|
2017-05-31 08:53:09 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'delete_message':
|
|
|
|
var msg_id = event.message_id;
|
2018-02-16 23:41:38 +01:00
|
|
|
// message is passed to unread.get_unread_messages,
|
|
|
|
// which returns all the unread messages out of a given list.
|
|
|
|
// So double marking something as read would not occur
|
2018-04-01 21:12:45 +02:00
|
|
|
unread_ops.process_read_messages_event([msg_id]);
|
2018-04-02 00:21:21 +02:00
|
|
|
if (event.message_type === 'stream') {
|
2018-03-04 21:26:19 +01:00
|
|
|
topic_data.remove_message({
|
2018-04-02 00:21:21 +02:00
|
|
|
stream_id: event.stream_id,
|
|
|
|
topic_name: event.topic,
|
2018-03-04 21:26:19 +01:00
|
|
|
});
|
|
|
|
stream_list.update_streams_sidebar();
|
|
|
|
}
|
2017-05-31 08:53:09 +02:00
|
|
|
ui.remove_message(msg_id);
|
|
|
|
break;
|
|
|
|
|
2017-11-17 06:15:19 +01:00
|
|
|
case 'user_group':
|
|
|
|
if (event.op === 'add') {
|
|
|
|
user_groups.add(event.group);
|
2018-03-04 17:39:54 +01:00
|
|
|
} else if (event.op === 'add_members') {
|
|
|
|
user_groups.add_members(event.group_id, event.user_ids);
|
|
|
|
} else if (event.op === 'remove_members') {
|
|
|
|
user_groups.remove_members(event.group_id, event.user_ids);
|
2018-03-14 17:52:38 +01:00
|
|
|
} else if (event.op === "update") {
|
|
|
|
user_groups.update(event);
|
2017-11-17 06:15:19 +01:00
|
|
|
}
|
2018-03-04 17:39:54 +01:00
|
|
|
settings_user_groups.reload();
|
2017-11-17 06:15:19 +01:00
|
|
|
break;
|
2017-05-31 08:53:09 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return exports;
|
|
|
|
|
|
|
|
}());
|
|
|
|
if (typeof module !== 'undefined') {
|
|
|
|
module.exports = server_events_dispatch;
|
|
|
|
}
|