Skip to content

Commit

Permalink
Merge pull request #29384 from nextcloud/backport/26725/stable21
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Nov 3, 2021
2 parents 9c13685 + 46290e9 commit d87894a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
13 changes: 10 additions & 3 deletions apps/settings/js/federationsettingsview.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
* @constructs FederationScopeMenu
* @memberof OC.Settings
* @param {object} options
* @param {bool} [options.lookupServerUploadEnabled=false] whether uploading to the lookup server is enabled
* @param {bool} [options.showFederatedScope=false] whether show the
* "v2-federated" scope or not
* @param {bool} [options.showPublishedScope=false] whether show the
* "v2-published" scope or not
*/
var FederationSettingsView = OC.Backbone.View.extend({
_inputFields: undefined,
Expand All @@ -31,7 +34,8 @@
} else {
this._config = new OC.Settings.UserSettings();
}
this.showFederationScopes = !!options.showFederationScopes;
this.showFederatedScope = !!options.showFederatedScope;
this.showPublishedScope = !!options.showPublishedScope;

this._inputFields = [
'displayname',
Expand Down Expand Up @@ -85,8 +89,11 @@
excludedScopes.push('v2-private');
}

if (!self.showFederationScopes) {
if (!self.showFederatedScope) {
excludedScopes.push('v2-federated');
}

if (!self.showPublishedScope) {
excludedScopes.push('v2-published');
}

Expand Down
3 changes: 2 additions & 1 deletion apps/settings/js/settings/personalInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ window.addEventListener('DOMContentLoaded', function () {
var federationSettingsView = new OC.Settings.FederationSettingsView({
el: settingsEl,
config: userSettings,
showFederationScopes: !!settingsEl.data('lookup-server-upload-enabled'),
showFederatedScope: !!settingsEl.data('federation-enabled'),
showPublishedScope: !!settingsEl.data('lookup-server-upload-enabled'),
});

userSettings.on("sync", function() {
Expand Down
2 changes: 2 additions & 0 deletions apps/settings/lib/Settings/Personal/PersonalInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function __construct(
}

public function getForm(): TemplateResponse {
$federationEnabled = $this->appManager->isEnabledForUser('federation');
$federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
$lookupServerUploadEnabled = false;
if ($federatedFileSharingEnabled) {
Expand Down Expand Up @@ -119,6 +120,7 @@ public function getForm(): TemplateResponse {
'usage_relative' => round($storageInfo['relative']),
'quota' => $storageInfo['quota'],
'avatarChangeSupported' => $user->canChangeAvatar(),
'federationEnabled' => $federationEnabled,
'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
'avatarScope' => $account->getProperty(IAccountManager::PROPERTY_AVATAR)->getScope(),
'displayNameChangeSupported' => $user->canChangeDisplayName(),
Expand Down
3 changes: 2 additions & 1 deletion apps/settings/templates/settings/personal/personal.info.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
]);
?>

<div id="personal-settings" data-lookup-server-upload-enabled="<?php p($_['lookupServerUploadEnabled'] ? 'true' : 'false') ?>">
<div id="personal-settings" data-federation-enabled="<?php p($_['federationEnabled'] ? 'true' : 'false') ?>"
data-lookup-server-upload-enabled="<?php p($_['lookupServerUploadEnabled'] ? 'true' : 'false') ?>">
<h2 class="hidden-visually"><?php p($l->t('Personal info')); ?></h2>
<div id="personal-settings-avatar-container" class="personal-settings-container">
<div>
Expand Down
1 change: 1 addition & 0 deletions tests/lib/Accounts/AccountPropertyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function scopesProvider() {
// current values
[IAccountManager::SCOPE_PRIVATE, IAccountManager::SCOPE_PRIVATE],
[IAccountManager::SCOPE_LOCAL, IAccountManager::SCOPE_LOCAL],
[IAccountManager::SCOPE_FEDERATED, IAccountManager::SCOPE_FEDERATED],
[IAccountManager::SCOPE_PUBLISHED, IAccountManager::SCOPE_PUBLISHED],
// legacy values
[IAccountManager::VISIBILITY_PRIVATE, IAccountManager::SCOPE_LOCAL],
Expand Down

0 comments on commit d87894a

Please sign in to comment.