Skip to content
Snippets Groups Projects
Commit a9ae91c0 authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

fix(component-user): changes after code review

parent 0c0727b0
No related branches found
No related tags found
3 merge requests!222Sprint #26,!217Sprint #26,!200Component user add user
......@@ -26,6 +26,31 @@ import {
withCountries,
} from 'pubsweet-component-faraday-ui'
// #region helpers
const setInitialRole = a => {
if (get(a, 'admin', false)) {
return 'admin'
}
if (get(a, 'handlingEditor', false)) {
return 'handlingEditor'
}
if (get(a, 'editorInChief', false)) {
return 'editorInChief'
}
return 'author'
}
const validate = values => {
const errors = {}
if (get(values, 'email', '') === '') {
errors.email = 'Required'
}
return errors
}
// #endregion
const FormModal = ({
edit,
roles,
......@@ -53,15 +78,7 @@ const FormModal = ({
<Formik
initialValues={initialValues}
onSubmit={onSubmit}
validate={values => {
const errors = {}
if (get(values, 'email', '') === '') {
errors.email = 'Required'
}
return errors
}}
validate={validate}
>
{({ handleSubmit, ...rest }) => (
<Fragment>
......@@ -152,19 +169,6 @@ const FormModal = ({
</Root>
)
const setInitialRole = a => {
if (get(a, 'admin', false)) {
return 'admin'
}
if (get(a, 'handlingEditor', false)) {
return 'handlingEditor'
}
if (get(a, 'editorInChief', false)) {
return 'editorInChief'
}
return 'author'
}
export default compose(
withRoles,
withFetching,
......
......@@ -44,9 +44,9 @@ const Users = ({
<ActionLink
data-test-id="go-to-dashboard"
fontIcon="arrowLeft"
paddingBottom={1.2}
mr={2}
onClick={history.goBack}
paddingBottom={1.2}
>
Admin Dashboard
</ActionLink>
......@@ -258,8 +258,3 @@ const UserRow = styled.tr`
}
}
`
// #endregion
// withHandlers({
// }),
......@@ -4,13 +4,12 @@
"description": "User component for Hindawi peer review app.",
"license": "MIT",
"author": "Collaborative Knowledge Foundation",
"files": [
"src"
],
"files": ["src"],
"main": "index.js",
"scripts": {
"test": "jest",
"docs": "./node_modules/.bin/apidoc -e \"(node_modules|public)\" -o public/apidoc",
"docs":
"./node_modules/.bin/apidoc -e \"(node_modules|public)\" -o public/apidoc",
"open-docs": "open public/apidoc/index.html"
},
"repository": {
......@@ -26,6 +25,8 @@
"graphql-tag": "^2.10.0",
"lodash": "^4.17.11",
"pubsweet-client": "^7.0.0",
"pubsweet-server": "^10.0.0",
"pubsweet-component-helper-service": "0.0.1",
"react": "^16.6.0",
"react-apollo": "^2.3.2",
"react-dom": "^16.6.0",
......@@ -35,12 +36,6 @@
"styled-components": "^4.1.2",
"xpub-validators": "^0.0.6"
},
"peerDependencies": {
"@pubsweet/component-send-email": "0.2.4",
"@pubsweet/logger": "^0.0.1",
"pubsweet-component-helper-service": "0.0.1",
"pubsweet-server": "^10.0.0"
},
"devDependencies": {
"apidoc": "^0.17.6",
"jest": "^23.6.0",
......
......@@ -15,7 +15,7 @@ class Notification {
async notifyUserAddedByAdmin(role) {
const resetPath = config.get('invite-reset-password.url')
const { user } = this
const baseUrl = config.get('hostname')
const baseUrl = config.get('pubsweet-client.baseUrl')
const emailType =
role === 'Handling Editor' ? 'he-added-by-admin' : 'user-added-by-admin'
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment