From: Daniel Calviño Sánchez
Date: Mon, 1 Feb 2021 02:34:36 +0000 (+0100)
Subject: Fix settings scope menu hidden when lookup server upload is disabled
X-Git-Tag: v20.0.10RC1~3^2~1
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e929d16bbb1b5c8b4d8d45a811e993477d2eb06a;p=nextcloud-server.git
Fix settings scope menu hidden when lookup server upload is disabled
When upload to the lookup server is disabled the scope menu was hidden
in the personal information settings. However, even if the lookup server
upload is disabled the personal information is still accesible from the
local server as well as trusted servers. Users should be able to still
set if their information is available to other users or if it is
private, so now the scope menu is always show (although the "Public"
option is hidden if the lookup server upload is disabled).
If the user set the information as public before the upload to the
lookup server was disabled the menu will also show the "Public" option
as active, although disabled. Setting the visibility to any of the other
options will hide the "Public" option from the menu (until the lookup
server upload is enabled again).
Signed-off-by: Daniel Calviño Sánchez
---
diff --git a/apps/settings/css/settings.scss b/apps/settings/css/settings.scss
index cc798868c53..4915dd7da7b 100644
--- a/apps/settings/css/settings.scss
+++ b/apps/settings/css/settings.scss
@@ -403,6 +403,16 @@ select {
font-weight: bold;
}
}
+
+ &.disabled {
+ opacity: .5;
+
+ cursor: default;
+
+ span {
+ cursor: default;
+ }
+ }
}
}
}
diff --git a/apps/settings/js/federationscopemenu.js b/apps/settings/js/federationscopemenu.js
index 170aec15a85..297cd006e58 100644
--- a/apps/settings/js/federationscopemenu.js
+++ b/apps/settings/js/federationscopemenu.js
@@ -117,6 +117,17 @@
break;
}
+ var lookupServerUploadEnabled = $('#lookupServerUploadEnabled').val();
+ if (!lookupServerUploadEnabled && !this._scopes[2].active) {
+ this._scopes[2].hidden = true
+ } else if (!lookupServerUploadEnabled && this._scopes[2].active) {
+ this._scopes[2].hidden = false
+ this._scopes[2].disabled = true
+ } else {
+ this._scopes[2].hidden = false
+ this._scopes[2].disabled = false
+ }
+
this.render();
this.$el.removeClass('hidden');
diff --git a/apps/settings/js/templates.js b/apps/settings/js/templates.js
index 25c2e790040..2cd8179f3ec 100644
--- a/apps/settings/js/templates.js
+++ b/apps/settings/js/templates.js
@@ -1,6 +1,15 @@
(function() {
var template = Handlebars.template, templates = OC.Settings.Templates = OC.Settings.Templates || {};
templates['federationscopemenu'] = template({"1":function(container,depth0,helpers,partials,data) {
+ var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
+ if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
+ return parent[propertyName];
+ }
+ return undefined
+ };
+
+ return ((stack1 = lookupProperty(helpers,"unless").call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"hidden") : depth0),{"name":"unless","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":2},"end":{"line":25,"column":13}}})) != null ? stack1 : "");
+},"2":function(container,depth0,helpers,partials,data) {
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
return parent[propertyName];
@@ -8,22 +17,49 @@ templates['federationscopemenu'] = template({"1":function(container,depth0,helpe
return undefined
};
- return "
\n";
},"useData":true});
})();
\ No newline at end of file
diff --git a/apps/settings/js/templates/federationscopemenu.handlebars b/apps/settings/js/templates/federationscopemenu.handlebars
index 4bd945b094d..c9d86c63142 100644
--- a/apps/settings/js/templates/federationscopemenu.handlebars
+++ b/apps/settings/js/templates/federationscopemenu.handlebars
@@ -1,7 +1,12 @@