Skip to content

Commit 4ba0aeb

Browse files
committed
Fix translation of user exists error server-side
Signed-off-by: Christopher Ng <chrng8@gmail.com>
1 parent f167fe0 commit 4ba0aeb

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

apps/provisioning_api/lib/Controller/UsersController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public function addUser(
350350

351351
if ($this->userManager->userExists($userid)) {
352352
$this->logger->error('Failed addUser attempt: User already exists.', ['app' => 'ocs_api']);
353-
throw new OCSException('User already exists', 102);
353+
throw new OCSException($this->l10nFactory->get('provisioning_api')->t('User already exists'), 102);
354354
}
355355

356356
if ($groups !== []) {

apps/settings/src/store/users.js

-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import api from './api'
3030
import axios from '@nextcloud/axios'
3131
import { generateOcsUrl } from '@nextcloud/router'
3232
import logger from '../logger'
33-
import { showError } from '@nextcloud/dialogs'
3433

3534
const orderGroups = function(groups, orderBy) {
3635
/* const SORT_USERCOUNT = 1;
@@ -553,13 +552,6 @@ const actions = {
553552
.then((response) => dispatch('addUserData', userid || response.data.ocs.data.id))
554553
.catch((error) => { throw error })
555554
}).catch((error) => {
556-
const statusCode = error?.response?.data?.ocs?.meta?.statuscode
557-
558-
if (statusCode === 102) {
559-
showError(t('settings', 'User already exists.'))
560-
throw error
561-
}
562-
563555
commit('API_FAILURE', { userid, error })
564556
throw error
565557
})

0 commit comments

Comments
 (0)