aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/js/federationscopemenu.js
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-03-23 11:38:25 +0100
committerVincent Petry <vincent@nextcloud.com>2021-03-26 13:07:08 +0100
commit9fb447ea427428c86a8d6be77d0145f4fb0ed777 (patch)
treeb8aa943599cf02618d532f18ea7aadb2d1fdadb0 /apps/settings/js/federationscopemenu.js
parentb81a1c1bdbf7c7ca3e71a7c7cd7eb21edd0a3fb9 (diff)
downloadnextcloud-server-9fb447ea427428c86a8d6be77d0145f4fb0ed777.tar.gz
nextcloud-server-9fb447ea427428c86a8d6be77d0145f4fb0ed777.zip
Adjust scopes menu based on conditions
Now not all fields have the "v2-private" option in place. Fix dropdown issue when a scope was stored that is not listed after disabling the lookup server. Whenever the lookup server upload is disabled, the scope menu is now displayed where it makes sense to allow switching between the two private scopes. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/settings/js/federationscopemenu.js')
-rw-r--r--apps/settings/js/federationscopemenu.js23
1 files changed, 6 insertions, 17 deletions
diff --git a/apps/settings/js/federationscopemenu.js b/apps/settings/js/federationscopemenu.js
index 1c854a7ee57..b94e1686a4e 100644
--- a/apps/settings/js/federationscopemenu.js
+++ b/apps/settings/js/federationscopemenu.js
@@ -57,7 +57,7 @@
}
];
- if (options.excludedScopes) {
+ if (options.excludedScopes && options.excludedScopes.length) {
this._scopes = this._scopes.filter(function(scopeEntry) {
return options.excludedScopes.indexOf(scopeEntry.name) === -1;
})
@@ -117,22 +117,11 @@
var currentlyActiveValue = $('#'+context.target.closest('form').id).find('input[type="hidden"]')[0].value;
for(var i in this._scopes) {
- this._scopes[i].active = false;
- }
-
- switch (currentlyActiveValue) {
- case 'v2-private':
- this._scopes[0].active = true;
- break;
- case 'private':
- this._scopes[1].active = true;
- break;
- case 'contacts':
- this._scopes[2].active = true;
- break;
- case 'public':
- this._scopes[3].active = true;
- break;
+ if (this._scopes[i].name === currentlyActiveValue) {
+ this._scopes[i].active = true;
+ } else {
+ this._scopes[i].active = false;
+ }
}
this.render();