From 8a15c629e25fbad5148c64d4b1b3c9f0f8174a9f Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Thu, 1 Sep 2022 19:00:48 +0000 Subject: Fix translation of user exists error server-side Signed-off-by: Christopher Ng --- apps/provisioning_api/lib/Controller/UsersController.php | 2 +- apps/settings/src/store/users.js | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'apps') diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 9bf05f4484d..e8b6fd0e8d9 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -350,7 +350,7 @@ class UsersController extends AUserData { if ($this->userManager->userExists($userid)) { $this->logger->error('Failed addUser attempt: User already exists.', ['app' => 'ocs_api']); - throw new OCSException('User already exists', 102); + throw new OCSException($this->l10nFactory->get('provisioning_api')->t('User already exists'), 102); } if ($groups !== []) { diff --git a/apps/settings/src/store/users.js b/apps/settings/src/store/users.js index c220e21e49f..8c9e65af29c 100644 --- a/apps/settings/src/store/users.js +++ b/apps/settings/src/store/users.js @@ -30,7 +30,6 @@ import api from './api' import axios from '@nextcloud/axios' import { generateOcsUrl } from '@nextcloud/router' import logger from '../logger' -import { showError } from '@nextcloud/dialogs' const orderGroups = function(groups, orderBy) { /* const SORT_USERCOUNT = 1; @@ -553,13 +552,6 @@ const actions = { .then((response) => dispatch('addUserData', userid || response.data.ocs.data.id)) .catch((error) => { throw error }) }).catch((error) => { - const statusCode = error?.response?.data?.ocs?.meta?.statuscode - - if (statusCode === 102) { - showError(t('settings', 'User already exists.')) - throw error - } - commit('API_FAILURE', { userid, error }) throw error }) -- cgit v1.2.3