Skip to content

Commit

Permalink
Merge pull request #33222 from nextcloud/bugfix/noid/fix-translation-…
Browse files Browse the repository at this point in the history
…of-user-exists-error
  • Loading branch information
Pytal authored Jul 14, 2022
2 parents 9671a8d + 0e7647c commit 4832853
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/settings/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ const mutations = {
API_FAILURE(state, error) {
try {
const message = error.error.response.data.ocs.meta.message
showError(t('settings', 'An error occured during the request. Unable to proceed.') + '<br>' + message, { isHTML: true })
showError(t('settings', 'An error occurred during the request. Unable to proceed.') + '<br>' + message, { isHTML: true })
} catch (e) {
showError(t('settings', 'An error occured during the request. Unable to proceed.'))
showError(t('settings', 'An error occurred during the request. Unable to proceed.'))
}
console.error(state, error)
},
Expand Down
8 changes: 8 additions & 0 deletions apps/settings/src/store/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ 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;
Expand Down Expand Up @@ -552,6 +553,13 @@ 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
})
Expand Down
Loading

0 comments on commit 4832853

Please sign in to comment.