Add integration manager provisioning setting

To be used later by a future implementation
pull/21833/head
Travis Ralston 2019-10-29 14:20:53 -06:00
parent 8dec435e50
commit dd8f26a3f6
2 changed files with 22 additions and 0 deletions

View File

@ -279,6 +279,10 @@ export const SETTINGS = {
supportedLevels: ['account'],
default: [],
},
"integration_provisioning": {
supportedLevels: ['account'],
default: true,
},
"analyticsOptIn": {
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
displayName: _td('Send analytics data'),

View File

@ -23,6 +23,8 @@ const BREADCRUMBS_LEGACY_EVENT_TYPE = "im.vector.riot.breadcrumb_rooms";
const BREADCRUMBS_EVENT_TYPE = "im.vector.setting.breadcrumbs";
const BREADCRUMBS_EVENT_TYPES = [BREADCRUMBS_LEGACY_EVENT_TYPE, BREADCRUMBS_EVENT_TYPE];
const INTEG_PROVISIONING_EVENT_TYPE = "im.vector.setting.integration_provisioning";
/**
* Gets and sets settings at the "account" level for the current user.
* This handler does not make use of the roomId parameter.
@ -61,6 +63,9 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
}
} else if (BREADCRUMBS_EVENT_TYPES.includes(event.getType())) {
this._notifyBreadcrumbsUpdate(event);
} else if (event.getType() === INTEG_PROVISIONING_EVENT_TYPE) {
let val = event.getContent()['enabled'];
this._watchers.notifyUpdate("integration_provisioning", null, SettingLevel.ACCOUNT, val);
}
}
@ -87,6 +92,12 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
return content && content['recent_rooms'] ? content['recent_rooms'] : [];
}
// Special case integration manager provisioning
if (settingName === "integration_provisioning") {
const content = this._getSettings(INTEG_PROVISIONING_EVENT_TYPE);
return content ? content['enabled'] : null;
}
const settings = this._getSettings() || {};
let preferredValue = settings[settingName];
@ -120,6 +131,13 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
return MatrixClientPeg.get().setAccountData(BREADCRUMBS_EVENT_TYPE, content);
}
// Special case integration manager provisioning
if (settingName === "integration_provisioning") {
const content = this._getSettings(INTEG_PROVISIONING_EVENT_TYPE) || {};
content['enabled'] = newValue;
return MatrixClientPeg.get().setAccountData(INTEG_PROVISIONING_EVENT_TYPE, content);
}
const content = this._getSettings() || {};
content[settingName] = newValue;
return MatrixClientPeg.get().setAccountData("im.vector.web.settings", content);