Merge pull request #34862 from nextcloud/backport/34785/stable25

[stable25] Fix disabled federated scope
This commit is contained in:
Vincent Petry 2022-11-04 17:20:14 +01:00 committed by GitHub
commit 0cb14bdcb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 18 deletions

View file

@ -138,7 +138,6 @@ class PersonalInfo implements ISettings {
$messageParameters = $this->getMessageParameters($account);
$parameters = [
'federationEnabled' => $federationEnabled,
'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(),
'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(),
@ -171,6 +170,7 @@ class PersonalInfo implements ISettings {
$accountParameters = [
'avatarChangeSupported' => $user->canChangeAvatar(),
'displayNameChangeSupported' => $user->canChangeDisplayName(),
'federationEnabled' => $federationEnabled,
'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
];

View file

@ -57,7 +57,10 @@ import {
import { savePrimaryAccountPropertyScope } from '../../../service/PersonalInfo/PersonalInfoService.js'
import logger from '../../../logger.js'
const { lookupServerUploadEnabled } = loadState('settings', 'accountParameters', {})
const {
federationEnabled,
lookupServerUploadEnabled,
} = loadState('settings', 'accountParameters', {})
export default {
name: 'FederationControl',
@ -120,15 +123,21 @@ export default {
},
supportedScopes() {
if (lookupServerUploadEnabled && !UNPUBLISHED_READABLE_PROPERTIES.includes(this.readable)) {
return [
...PROPERTY_READABLE_SUPPORTED_SCOPES_ENUM[this.readable],
SCOPE_ENUM.FEDERATED,
SCOPE_ENUM.PUBLISHED,
]
const scopes = PROPERTY_READABLE_SUPPORTED_SCOPES_ENUM[this.readable]
if (UNPUBLISHED_READABLE_PROPERTIES.includes(this.readable)) {
return scopes
}
return PROPERTY_READABLE_SUPPORTED_SCOPES_ENUM[this.readable]
if (federationEnabled) {
scopes.push(SCOPE_ENUM.FEDERATED)
}
if (lookupServerUploadEnabled) {
scopes.push(SCOPE_ENUM.PUBLISHED)
}
return scopes
},
},

View file

@ -175,7 +175,7 @@ export const SCOPE_PROPERTY_ENUM = Object.freeze({
name: SCOPE_ENUM.FEDERATED,
displayName: t('settings', 'Federated'),
tooltip: t('settings', 'Only synchronize to trusted servers'),
tooltipDisabled: t('settings', 'Not available as publishing user specific data to the lookup server is not allowed, contact your system administrator if you have any questions'),
tooltipDisabled: t('settings', 'Not available as federation has been disabled for your account, contact your system administrator if you have any questions'),
iconClass: 'icon-contacts-dark',
},
[SCOPE_ENUM.PUBLISHED]: {

View file

@ -43,8 +43,7 @@ script('settings', [
</div>
<?php endif; ?>
<div id="personal-settings" data-federation-enabled="<?php p($_['federationEnabled'] ? 'true' : 'false') ?>"
data-lookup-server-upload-enabled="<?php p($_['lookupServerUploadEnabled'] ? 'true' : 'false') ?>">
<div id="personal-settings">
<h2 class="hidden-visually"><?php p($l->t('Personal info')); ?></h2>
<div id="personal-settings-avatar-container" class="personal-settings-container">
<div id="vue-avatar-section"></div>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long