Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix translation of user exists error #33222

Merged
merged 2 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Pytal marked this conversation as resolved.
Show resolved Hide resolved
}

commit('API_FAILURE', { userid, error })
throw error
})
Expand Down
Loading