Fix languages empty array
Signed-off-by: GretaD <gretadoci@gmail.com>
This commit is contained in:
parent
76334c4c90
commit
adbdecb1d6
|
@ -146,7 +146,7 @@ abstract class AUserData extends OCSController {
|
||||||
$data[AccountManager::PROPERTY_WEBSITE] = $userAccount[AccountManager::PROPERTY_WEBSITE]['value'];
|
$data[AccountManager::PROPERTY_WEBSITE] = $userAccount[AccountManager::PROPERTY_WEBSITE]['value'];
|
||||||
$data[AccountManager::PROPERTY_TWITTER] = $userAccount[AccountManager::PROPERTY_TWITTER]['value'];
|
$data[AccountManager::PROPERTY_TWITTER] = $userAccount[AccountManager::PROPERTY_TWITTER]['value'];
|
||||||
$data['groups'] = $gids;
|
$data['groups'] = $gids;
|
||||||
$data['language'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'lang');
|
$data['language'] = $this->config->getSystemValue('force_language', $this->config->getUserValue($targetUserObject->getUID(), 'core', 'lang'));
|
||||||
$data['locale'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'locale');
|
$data['locale'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'locale');
|
||||||
|
|
||||||
$backend = $targetUserObject->getBackend();
|
$backend = $targetUserObject->getBackend();
|
||||||
|
|
|
@ -958,6 +958,11 @@ class UsersControllerTest extends TestCase {
|
||||||
->method('getUserValue')
|
->method('getUserValue')
|
||||||
->with('UID', 'core', 'lang')
|
->with('UID', 'core', 'lang')
|
||||||
->willReturn('de');
|
->willReturn('de');
|
||||||
|
$this->config
|
||||||
|
->expects($this->once())
|
||||||
|
->method('getSystemValue')
|
||||||
|
->with('force_language', 'de')
|
||||||
|
->willReturn('de');
|
||||||
$this->api
|
$this->api
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('fillStorageInfo')
|
->method('fillStorageInfo')
|
||||||
|
@ -1073,6 +1078,11 @@ class UsersControllerTest extends TestCase {
|
||||||
->method('getUserValue')
|
->method('getUserValue')
|
||||||
->with('UID', 'core', 'enabled', 'true')
|
->with('UID', 'core', 'enabled', 'true')
|
||||||
->willReturn('true');
|
->willReturn('true');
|
||||||
|
$this->config
|
||||||
|
->expects($this->once())
|
||||||
|
->method('getSystemValue')
|
||||||
|
->with('force_language', 'da')
|
||||||
|
->willReturn('da');
|
||||||
$this->config
|
$this->config
|
||||||
->expects($this->at(1))
|
->expects($this->at(1))
|
||||||
->method('getUserValue')
|
->method('getUserValue')
|
||||||
|
@ -1245,6 +1255,11 @@ class UsersControllerTest extends TestCase {
|
||||||
->method('fillStorageInfo')
|
->method('fillStorageInfo')
|
||||||
->with('UID')
|
->with('UID')
|
||||||
->willReturn(['DummyValue']);
|
->willReturn(['DummyValue']);
|
||||||
|
$this->config
|
||||||
|
->expects($this->once())
|
||||||
|
->method('getSystemValue')
|
||||||
|
->with('force_language', 'ru')
|
||||||
|
->willReturn('ru');
|
||||||
|
|
||||||
$backend = $this->createMock(UserInterface::class);
|
$backend = $this->createMock(UserInterface::class);
|
||||||
$backend->expects($this->atLeastOnce())
|
$backend->expects($this->atLeastOnce())
|
||||||
|
|
|
@ -236,6 +236,7 @@ class UsersController extends Controller {
|
||||||
$serverData['userCount'] = $userCount;
|
$serverData['userCount'] = $userCount;
|
||||||
$serverData['languages'] = $languages;
|
$serverData['languages'] = $languages;
|
||||||
$serverData['defaultLanguage'] = $this->config->getSystemValue('default_language', 'en');
|
$serverData['defaultLanguage'] = $this->config->getSystemValue('default_language', 'en');
|
||||||
|
$serverData['forceLanguage'] = $this->config->getSystemValue('force_language', false);
|
||||||
// Settings
|
// Settings
|
||||||
$serverData['defaultQuota'] = $defaultQuota;
|
$serverData['defaultQuota'] = $defaultQuota;
|
||||||
$serverData['canChangePassword'] = $canChangePassword;
|
$serverData['canChangePassword'] = $canChangePassword;
|
||||||
|
|
|
@ -585,7 +585,16 @@ class Factory implements IFactory {
|
||||||
public function getLanguages() {
|
public function getLanguages() {
|
||||||
$forceLanguage = $this->config->getSystemValue('force_language', false);
|
$forceLanguage = $this->config->getSystemValue('force_language', false);
|
||||||
if ($forceLanguage !== false) {
|
if ($forceLanguage !== false) {
|
||||||
return [];
|
$l = $this->get('lib', $forceLanguage);
|
||||||
|
$potentialName = (string) $l->t('__language_name__');
|
||||||
|
|
||||||
|
return [
|
||||||
|
'commonlanguages' => [[
|
||||||
|
'code' => $forceLanguage,
|
||||||
|
'name' => $potentialName,
|
||||||
|
]],
|
||||||
|
'languages' => [],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$languageCodes = $this->findAvailableLanguages();
|
$languageCodes = $this->findAvailableLanguages();
|
||||||
|
|
Loading…
Reference in New Issue