mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Cleanup in general
This commit is contained in:
parent
cad37a8666
commit
e00de176e2
@ -23,12 +23,10 @@
|
||||
</ds-space>
|
||||
</div>
|
||||
<div v-else class="create-account-card">
|
||||
<!-- Wolle ??? submit -->
|
||||
<ds-form
|
||||
class="create-user-account"
|
||||
v-model="formData"
|
||||
:schema="formSchema"
|
||||
@submit="submit"
|
||||
@input="handleInput"
|
||||
@input-valid="handleInputValid"
|
||||
>
|
||||
@ -136,7 +134,7 @@ export default {
|
||||
},
|
||||
...passwordForm.formSchema,
|
||||
},
|
||||
response: null, // Wolle
|
||||
response: null,
|
||||
// TODO: Our styleguide does not support checkmarks.
|
||||
// Integrate termsAndConditionsConfirmed into `this.formData` once we
|
||||
// have checkmarks available.
|
||||
|
||||
@ -6,26 +6,11 @@
|
||||
@input="handleInput"
|
||||
@input-valid="handleInputValid"
|
||||
>
|
||||
<!-- Wolle <h1>
|
||||
{{
|
||||
invitation
|
||||
? $t('profile.invites.title', metadata)
|
||||
: $t('components.registration.signup.title', metadata)
|
||||
}}
|
||||
</h1> -->
|
||||
<!-- Wolle <ds-text
|
||||
v-if="token"
|
||||
v-html="$t('registration.signup.form.invitation-code', { code: token })"
|
||||
/> -->
|
||||
<ds-text>
|
||||
{{
|
||||
invitation
|
||||
? $t('profile.invites.description')
|
||||
: $t('components.registration.signup.form.description')
|
||||
}}
|
||||
{{ $t('components.registration.signup.form.description') }}
|
||||
</ds-text>
|
||||
<ds-input
|
||||
:placeholder="invitation ? $t('profile.invites.emailPlaceholder') : $t('login.email')"
|
||||
:placeholder="$t('login.email')"
|
||||
type="email"
|
||||
id="email"
|
||||
model="email"
|
||||
@ -48,7 +33,6 @@ import metadata from '~/constants/metadata'
|
||||
import { isEmail } from 'validator'
|
||||
import normalizeEmail from '~/components/utils/NormalizeEmail'
|
||||
import translateErrorMessage from '~/components/utils/TranslateErrorMessage'
|
||||
// Wolle import { SweetalertIcon } from 'vue-sweetalert-icons'
|
||||
|
||||
export const SignupMutation = gql`
|
||||
mutation($email: String!, $inviteCode: String) {
|
||||
@ -59,13 +43,8 @@ export const SignupMutation = gql`
|
||||
`
|
||||
export default {
|
||||
name: 'RegistrationSlideEmail',
|
||||
components: {
|
||||
// Wolle SweetalertIcon,
|
||||
},
|
||||
props: {
|
||||
sliderData: { type: Object, required: true },
|
||||
// token: { type: String, default: null }, // Wolle not used???
|
||||
invitation: { type: Boolean, default: false }, // Wolle ???
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@ -67,6 +67,7 @@
|
||||
import gql from 'graphql-tag'
|
||||
import metadata from '~/constants/metadata'
|
||||
import { SweetalertIcon } from 'vue-sweetalert-icons'
|
||||
import translateErrorMessage from '~/components/utils/TranslateErrorMessage'
|
||||
|
||||
export const SignupMutation = gql`
|
||||
mutation($email: String!, $inviteCode: String) {
|
||||
@ -127,21 +128,16 @@ export default {
|
||||
this.$emit('submit', { email: this.data.Signup.email })
|
||||
}, 3000)
|
||||
} catch (err) {
|
||||
const { message } = err
|
||||
const mapping = {
|
||||
'A user account with this email already exists': 'email-exists',
|
||||
// Wolle 'Invitation code already used or does not exist': 'invalid-invitation-token',
|
||||
}
|
||||
for (const [pattern, key] of Object.entries(mapping)) {
|
||||
if (message.includes(pattern))
|
||||
this.error = {
|
||||
key,
|
||||
message: this.$t(`components.registration.signup.form.errors.${key}`),
|
||||
}
|
||||
}
|
||||
if (!this.error) {
|
||||
this.$toast.error(message)
|
||||
}
|
||||
this.$toast.error(
|
||||
translateErrorMessage(
|
||||
err.message,
|
||||
{
|
||||
'A user account with this email already exists':
|
||||
'components.registration.signup.form.errors.email-exists',
|
||||
},
|
||||
this.$t,
|
||||
),
|
||||
)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@ -198,7 +198,6 @@
|
||||
"errors": {
|
||||
"email-exists": "Es gibt schon ein Benutzerkonto mit dieser E-Mail-Adresse!"
|
||||
},
|
||||
"invitation-code": "Dein Einladungscode lautet: <b>{code}</b>",
|
||||
"minimum-age": "Ich bin 18 Jahre oder älter.",
|
||||
"no-commercial": "Ich habe keine kommerziellen Absichten und ich repräsentiere kein kommerzielles Unternehmen oder Organisation.",
|
||||
"no-political": "Ich bin nicht im Auftrag einer Partei oder politischen Organisation im Netzwerk.",
|
||||
|
||||
@ -198,7 +198,6 @@
|
||||
"errors": {
|
||||
"email-exists": "There is already a user account with this e-mail address!"
|
||||
},
|
||||
"invitation-code": "Your invitation code is: <b>{code}</b>",
|
||||
"minimum-age": "I'm 18 years or older.",
|
||||
"no-commercial": "I have no commercial interests and I am not representing a company or any other commercial organisation on the network.",
|
||||
"no-political": "I am not on behalf of a party or political organization in the network.",
|
||||
|
||||
@ -155,7 +155,6 @@
|
||||
"errors": {
|
||||
"email-exists": "¡Ya hay una cuenta de usuario con esta dirección de correo electrónico!"
|
||||
},
|
||||
"invitation-code": "Su código de invitación es: <b>{code}</b>",
|
||||
"minimum-age": "Tengo 18 años o más.",
|
||||
"no-commercial": "No tengo intensiones comerciales y no represento una empresa u organización comercial.",
|
||||
"no-political": "No estoy en la red en nombre de un partido o una organización política.",
|
||||
|
||||
@ -155,7 +155,6 @@
|
||||
"errors": {
|
||||
"email-exists": "Il existe déjà un compte utilisateur avec cette adresse mail!"
|
||||
},
|
||||
"invitation-code": "Votre code d'invitation est: <b> {code} </b>",
|
||||
"minimum-age": "J'ai 18 ans ou plus.",
|
||||
"no-commercial": "Je n'ai aucun intérêt commercial et je ne représente pas d'entreprise ou toute autre organisation commerciale sur le réseau.",
|
||||
"no-political": "Je ne parle pas au nom d'un parti ou d'une organisation politique sur le réseau.",
|
||||
|
||||
@ -162,7 +162,6 @@
|
||||
"errors": {
|
||||
"email-exists": null
|
||||
},
|
||||
"invitation-code": null,
|
||||
"minimum-age": null,
|
||||
"submit": null,
|
||||
"success": null,
|
||||
|
||||
@ -202,7 +202,6 @@
|
||||
"errors": {
|
||||
"email-exists": "Já existe uma conta de usuário com este endereço de e-mail!"
|
||||
},
|
||||
"invitation-code": "O seu código de convite é: <b>{code}</b>",
|
||||
"minimum-age": "Tenho 18 anos ou mais.",
|
||||
"submit": "Criar uma conta",
|
||||
"success": "Um e-mail com um link para completar o seu registo foi enviado para <b>{email}</b>",
|
||||
|
||||
@ -155,7 +155,6 @@
|
||||
"errors": {
|
||||
"email-exists": "Уже есть учетная запись пользователя с этим адресом электронной почты!"
|
||||
},
|
||||
"invitation-code": "Код приглашения: <b>{code}</b>",
|
||||
"minimum-age": "Мне 18 лет или более",
|
||||
"no-commercial": "У меня нет коммерческих намерений, и я не представляю коммерческое предприятие или организацию.",
|
||||
"no-political": "Я не от имени какой-либо партии или политической организации в сети.",
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { config, mount } from '@vue/test-utils'
|
||||
import Registration from './registration.vue'
|
||||
import Vuex from 'vuex'
|
||||
import Vue from 'vue'
|
||||
|
||||
const localVue = global.localVue
|
||||
@ -13,78 +12,14 @@ config.stubs['infinite-loading'] = '<span><slot /></span>'
|
||||
describe('Registration', () => {
|
||||
let wrapper
|
||||
let Wrapper
|
||||
let store
|
||||
let mocks
|
||||
let mutations
|
||||
|
||||
beforeEach(() => {
|
||||
mutations = {
|
||||
'posts/SELECT_ORDER': jest.fn(),
|
||||
}
|
||||
// Wolle what is needed here?
|
||||
store = new Vuex.Store({
|
||||
getters: {
|
||||
'posts/filter': () => ({}),
|
||||
'posts/orderOptions': () => () => [
|
||||
{
|
||||
key: 'store.posts.orderBy.oldest.label',
|
||||
label: 'store.posts.orderBy.oldest.label',
|
||||
icon: 'sort-amount-asc',
|
||||
value: 'createdAt_asc',
|
||||
},
|
||||
{
|
||||
key: 'store.posts.orderBy.newest.label',
|
||||
label: 'store.posts.orderBy.newest.label',
|
||||
icon: 'sort-amount-desc',
|
||||
value: 'createdAt_desc',
|
||||
},
|
||||
],
|
||||
'posts/selectedOrder': () => () => 'createdAt_desc',
|
||||
'posts/orderIcon': () => 'sort-amount-desc',
|
||||
'posts/orderBy': () => 'createdAt_desc',
|
||||
'auth/user': () => {
|
||||
return { id: 'u23' }
|
||||
},
|
||||
},
|
||||
mutations,
|
||||
})
|
||||
mocks = {
|
||||
$t: (key) => key,
|
||||
$filters: {
|
||||
truncate: (a) => a,
|
||||
removeLinks: jest.fn(),
|
||||
},
|
||||
$i18n: {
|
||||
locale: () => 'de',
|
||||
},
|
||||
// If you are mocking router, than don't use VueRouter with localVue: https://vue-test-utils.vuejs.org/guides/using-with-vue-router.html
|
||||
$router: {
|
||||
history: {
|
||||
push: jest.fn(),
|
||||
},
|
||||
push: jest.fn(),
|
||||
},
|
||||
$toast: {
|
||||
success: jest.fn(),
|
||||
error: jest.fn(),
|
||||
},
|
||||
$apollo: {
|
||||
mutate: jest.fn().mockResolvedValue(),
|
||||
queries: {
|
||||
Post: {
|
||||
refetch: jest.fn(),
|
||||
fetchMore: jest.fn().mockResolvedValue([
|
||||
{
|
||||
id: 'p23',
|
||||
name: 'It is a post',
|
||||
author: {
|
||||
id: 'u1',
|
||||
},
|
||||
},
|
||||
]),
|
||||
},
|
||||
},
|
||||
},
|
||||
$route: {
|
||||
query: {},
|
||||
},
|
||||
@ -95,16 +30,11 @@ describe('Registration', () => {
|
||||
describe('mount', () => {
|
||||
Wrapper = () => {
|
||||
return mount(Registration, {
|
||||
store,
|
||||
mocks,
|
||||
localVue,
|
||||
})
|
||||
}
|
||||
|
||||
// Wolle beforeEach(() => {
|
||||
// wrapper = Wrapper()
|
||||
// })
|
||||
|
||||
describe('no "PUBLIC_REGISTRATION" and no "INVITE_REGISTRATION"', () => {
|
||||
beforeEach(() => {
|
||||
mocks.$env = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user