take over changes from #5084
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
0dcce5a835
commit
d7a2290ce1
3 changed files with 59 additions and 10 deletions
|
@ -975,7 +975,8 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
$c->query(AccountManager::class),
|
||||
$c->getGroupManager(),
|
||||
$c->getL10NFactory(),
|
||||
$c->getThemingDefaults()
|
||||
$c->getThemingDefaults(),
|
||||
$c->getAppManager()
|
||||
);
|
||||
return $manager;
|
||||
});
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
namespace OC\Settings;
|
||||
|
||||
use OC\Accounts\AccountManager;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Encryption\IManager as EncryptionManager;
|
||||
use OCP\IConfig;
|
||||
|
@ -69,6 +70,8 @@ class Manager implements IManager {
|
|||
private $l10nFactory;
|
||||
/** @var \OC_Defaults */
|
||||
private $defaults;
|
||||
/** @var IAppManager */
|
||||
private $appManager;
|
||||
|
||||
/**
|
||||
* @param ILogger $log
|
||||
|
@ -100,7 +103,8 @@ class Manager implements IManager {
|
|||
AccountManager $accountManager,
|
||||
IGroupManager $groupManager,
|
||||
IFactory $l10nFactory,
|
||||
\OC_Defaults $defaults
|
||||
\OC_Defaults $defaults,
|
||||
IAppManager $appManager
|
||||
) {
|
||||
$this->log = $log;
|
||||
$this->dbc = $dbc;
|
||||
|
@ -116,6 +120,7 @@ class Manager implements IManager {
|
|||
$this->groupManager = $groupManager;
|
||||
$this->l10nFactory = $l10nFactory;
|
||||
$this->defaults = $defaults;
|
||||
$this->appManager = $appManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -402,7 +407,15 @@ class Manager implements IManager {
|
|||
try {
|
||||
if ($section === 'personal-info') {
|
||||
/** @var ISettings $form */
|
||||
$form = new Personal\PersonalInfo($this->config, $this->userManager, $this->groupManager, $this->accountManager, $this->l10nFactory, $this->l);
|
||||
$form = new Personal\PersonalInfo(
|
||||
$this->config,
|
||||
$this->userManager,
|
||||
$this->groupManager,
|
||||
$this->accountManager,
|
||||
$this->appManager,
|
||||
$this->l10nFactory,
|
||||
$this->l
|
||||
);
|
||||
$forms[$form->getPriority()] = [$form];
|
||||
}
|
||||
if($section === 'sessions') {
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
namespace OC\Settings\Personal;
|
||||
|
||||
use OC\Accounts\AccountManager;
|
||||
use OCA\FederatedFileSharing\AppInfo\Application;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\Files\FileInfo;
|
||||
use OCP\IConfig;
|
||||
|
@ -45,6 +47,8 @@ class PersonalInfo implements ISettings {
|
|||
private $accountManager;
|
||||
/** @var IGroupManager */
|
||||
private $groupManager;
|
||||
/** @var IAppManager */
|
||||
private $appManager;
|
||||
/** @var IFactory */
|
||||
private $l10nFactory;
|
||||
|
||||
|
@ -69,6 +73,7 @@ class PersonalInfo implements ISettings {
|
|||
IUserManager $userManager,
|
||||
IGroupManager $groupManager,
|
||||
AccountManager $accountManager,
|
||||
IAppManager $appManager,
|
||||
IFactory $l10nFactory,
|
||||
IL10N $l
|
||||
) {
|
||||
|
@ -76,6 +81,7 @@ class PersonalInfo implements ISettings {
|
|||
$this->userManager = $userManager;
|
||||
$this->accountManager = $accountManager;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->appManager = $appManager;
|
||||
$this->l10nFactory = $l10nFactory;
|
||||
$this->l = $l;
|
||||
}
|
||||
|
@ -85,8 +91,13 @@ class PersonalInfo implements ISettings {
|
|||
* @since 9.1
|
||||
*/
|
||||
public function getForm() {
|
||||
$lookupServerUploadEnabled = $this->config->getAppValue('files_sharing', 'lookupServerUploadEnabled', 'yes');
|
||||
$lookupServerUploadEnabled = $lookupServerUploadEnabled === 'yes';
|
||||
$federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
|
||||
$lookupServerUploadEnabled = false;
|
||||
if($federatedFileSharingEnabled) {
|
||||
$federatedFileSharing = new Application();
|
||||
$shareProvider = $federatedFileSharing->getFederatedShareProvider();
|
||||
$lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled();
|
||||
}
|
||||
|
||||
$uid = \OC_User::getUser();
|
||||
$user = $this->userManager->get($uid);
|
||||
|
@ -100,6 +111,7 @@ class PersonalInfo implements ISettings {
|
|||
}
|
||||
|
||||
list($activeLanguage, $commonLanguages, $languages) = $this->getLanguages($user);
|
||||
$messageParameters = $this->getMessageParameters($userData);
|
||||
|
||||
$parameters = [
|
||||
'total_space' => $totalSpace,
|
||||
|
@ -108,17 +120,17 @@ class PersonalInfo implements ISettings {
|
|||
'quota' => $storageInfo['quota'],
|
||||
'avatarChangeSupported' => \OC_User::canUserChangeAvatar($uid),
|
||||
'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
|
||||
'avatar_scope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],
|
||||
'avatarScope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],
|
||||
'displayNameChangeSupported' => \OC_User::canUserChangeDisplayName($uid),
|
||||
'displayName' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['value'],
|
||||
'displayNameScope' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['scope'],
|
||||
'email' => $userData[AccountManager::PROPERTY_EMAIL]['value'],
|
||||
'emailScope' => $userData[AccountManager::PROPERTY_EMAIL]['scope'],
|
||||
'emailMesage' => '',
|
||||
'emailVerification' => $userData[AccountManager::PROPERTY_EMAIL]['verified'],
|
||||
'phone' => $userData[AccountManager::PROPERTY_PHONE]['value'],
|
||||
'phoneScope' => $userData[AccountManager::PROPERTY_PHONE]['scope'],
|
||||
'address', $userData[AccountManager::PROPERTY_ADDRESS]['value'],
|
||||
'addressScope', $userData[AccountManager::PROPERTY_ADDRESS]['scope'],
|
||||
'address' => $userData[AccountManager::PROPERTY_ADDRESS]['value'],
|
||||
'addressScope' => $userData[AccountManager::PROPERTY_ADDRESS]['scope'],
|
||||
'website' => $userData[AccountManager::PROPERTY_WEBSITE]['value'],
|
||||
'websiteScope' => $userData[AccountManager::PROPERTY_WEBSITE]['scope'],
|
||||
'websiteVerification' => $userData[AccountManager::PROPERTY_WEBSITE]['verified'],
|
||||
|
@ -130,7 +142,7 @@ class PersonalInfo implements ISettings {
|
|||
'activelanguage' => $activeLanguage,
|
||||
'commonlanguages' => $commonLanguages,
|
||||
'languages' => $languages,
|
||||
];
|
||||
] + $messageParameters;
|
||||
|
||||
|
||||
return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, '');
|
||||
|
@ -237,4 +249,27 @@ class PersonalInfo implements ISettings {
|
|||
return [$userLang, $commonLanguages, $languages];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $userData
|
||||
* @return array
|
||||
*/
|
||||
private function getMessageParameters(array $userData) {
|
||||
$needVerifyMessage = [AccountManager::PROPERTY_EMAIL, AccountManager::PROPERTY_WEBSITE, AccountManager::PROPERTY_TWITTER];
|
||||
$messageParameters = [];
|
||||
foreach ($needVerifyMessage as $property) {
|
||||
switch ($userData[$property]['verified']) {
|
||||
case AccountManager::VERIFIED:
|
||||
$message = $this->l->t('Verifying');
|
||||
break;
|
||||
case AccountManager::VERIFICATION_IN_PROGRESS:
|
||||
$message = $this->l->t('Verifying …');
|
||||
break;
|
||||
default:
|
||||
$message = $this->l->t('Verify');
|
||||
}
|
||||
$messageParameters[$property . 'Message'] = $message;
|
||||
}
|
||||
return $messageParameters;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue