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>
|
</ds-space>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="create-account-card">
|
<div v-else class="create-account-card">
|
||||||
<!-- Wolle ??? submit -->
|
|
||||||
<ds-form
|
<ds-form
|
||||||
class="create-user-account"
|
class="create-user-account"
|
||||||
v-model="formData"
|
v-model="formData"
|
||||||
:schema="formSchema"
|
:schema="formSchema"
|
||||||
@submit="submit"
|
|
||||||
@input="handleInput"
|
@input="handleInput"
|
||||||
@input-valid="handleInputValid"
|
@input-valid="handleInputValid"
|
||||||
>
|
>
|
||||||
@ -136,7 +134,7 @@ export default {
|
|||||||
},
|
},
|
||||||
...passwordForm.formSchema,
|
...passwordForm.formSchema,
|
||||||
},
|
},
|
||||||
response: null, // Wolle
|
response: null,
|
||||||
// TODO: Our styleguide does not support checkmarks.
|
// TODO: Our styleguide does not support checkmarks.
|
||||||
// Integrate termsAndConditionsConfirmed into `this.formData` once we
|
// Integrate termsAndConditionsConfirmed into `this.formData` once we
|
||||||
// have checkmarks available.
|
// have checkmarks available.
|
||||||
|
|||||||
@ -6,26 +6,11 @@
|
|||||||
@input="handleInput"
|
@input="handleInput"
|
||||||
@input-valid="handleInputValid"
|
@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>
|
<ds-text>
|
||||||
{{
|
{{ $t('components.registration.signup.form.description') }}
|
||||||
invitation
|
|
||||||
? $t('profile.invites.description')
|
|
||||||
: $t('components.registration.signup.form.description')
|
|
||||||
}}
|
|
||||||
</ds-text>
|
</ds-text>
|
||||||
<ds-input
|
<ds-input
|
||||||
:placeholder="invitation ? $t('profile.invites.emailPlaceholder') : $t('login.email')"
|
:placeholder="$t('login.email')"
|
||||||
type="email"
|
type="email"
|
||||||
id="email"
|
id="email"
|
||||||
model="email"
|
model="email"
|
||||||
@ -48,7 +33,6 @@ import metadata from '~/constants/metadata'
|
|||||||
import { isEmail } from 'validator'
|
import { isEmail } from 'validator'
|
||||||
import normalizeEmail from '~/components/utils/NormalizeEmail'
|
import normalizeEmail from '~/components/utils/NormalizeEmail'
|
||||||
import translateErrorMessage from '~/components/utils/TranslateErrorMessage'
|
import translateErrorMessage from '~/components/utils/TranslateErrorMessage'
|
||||||
// Wolle import { SweetalertIcon } from 'vue-sweetalert-icons'
|
|
||||||
|
|
||||||
export const SignupMutation = gql`
|
export const SignupMutation = gql`
|
||||||
mutation($email: String!, $inviteCode: String) {
|
mutation($email: String!, $inviteCode: String) {
|
||||||
@ -59,13 +43,8 @@ export const SignupMutation = gql`
|
|||||||
`
|
`
|
||||||
export default {
|
export default {
|
||||||
name: 'RegistrationSlideEmail',
|
name: 'RegistrationSlideEmail',
|
||||||
components: {
|
|
||||||
// Wolle SweetalertIcon,
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
sliderData: { type: Object, required: true },
|
sliderData: { type: Object, required: true },
|
||||||
// token: { type: String, default: null }, // Wolle not used???
|
|
||||||
invitation: { type: Boolean, default: false }, // Wolle ???
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -67,6 +67,7 @@
|
|||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import metadata from '~/constants/metadata'
|
import metadata from '~/constants/metadata'
|
||||||
import { SweetalertIcon } from 'vue-sweetalert-icons'
|
import { SweetalertIcon } from 'vue-sweetalert-icons'
|
||||||
|
import translateErrorMessage from '~/components/utils/TranslateErrorMessage'
|
||||||
|
|
||||||
export const SignupMutation = gql`
|
export const SignupMutation = gql`
|
||||||
mutation($email: String!, $inviteCode: String) {
|
mutation($email: String!, $inviteCode: String) {
|
||||||
@ -127,21 +128,16 @@ export default {
|
|||||||
this.$emit('submit', { email: this.data.Signup.email })
|
this.$emit('submit', { email: this.data.Signup.email })
|
||||||
}, 3000)
|
}, 3000)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const { message } = err
|
this.$toast.error(
|
||||||
const mapping = {
|
translateErrorMessage(
|
||||||
'A user account with this email already exists': 'email-exists',
|
err.message,
|
||||||
// Wolle 'Invitation code already used or does not exist': 'invalid-invitation-token',
|
{
|
||||||
}
|
'A user account with this email already exists':
|
||||||
for (const [pattern, key] of Object.entries(mapping)) {
|
'components.registration.signup.form.errors.email-exists',
|
||||||
if (message.includes(pattern))
|
},
|
||||||
this.error = {
|
this.$t,
|
||||||
key,
|
),
|
||||||
message: this.$t(`components.registration.signup.form.errors.${key}`),
|
)
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!this.error) {
|
|
||||||
this.$toast.error(message)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -198,7 +198,6 @@
|
|||||||
"errors": {
|
"errors": {
|
||||||
"email-exists": "Es gibt schon ein Benutzerkonto mit dieser E-Mail-Adresse!"
|
"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.",
|
"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-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.",
|
"no-political": "Ich bin nicht im Auftrag einer Partei oder politischen Organisation im Netzwerk.",
|
||||||
|
|||||||
@ -198,7 +198,6 @@
|
|||||||
"errors": {
|
"errors": {
|
||||||
"email-exists": "There is already a user account with this e-mail address!"
|
"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.",
|
"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-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.",
|
"no-political": "I am not on behalf of a party or political organization in the network.",
|
||||||
|
|||||||
@ -155,7 +155,6 @@
|
|||||||
"errors": {
|
"errors": {
|
||||||
"email-exists": "¡Ya hay una cuenta de usuario con esta dirección de correo electrónico!"
|
"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.",
|
"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-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.",
|
"no-political": "No estoy en la red en nombre de un partido o una organización política.",
|
||||||
|
|||||||
@ -155,7 +155,6 @@
|
|||||||
"errors": {
|
"errors": {
|
||||||
"email-exists": "Il existe déjà un compte utilisateur avec cette adresse mail!"
|
"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.",
|
"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-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.",
|
"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": {
|
"errors": {
|
||||||
"email-exists": null
|
"email-exists": null
|
||||||
},
|
},
|
||||||
"invitation-code": null,
|
|
||||||
"minimum-age": null,
|
"minimum-age": null,
|
||||||
"submit": null,
|
"submit": null,
|
||||||
"success": null,
|
"success": null,
|
||||||
|
|||||||
@ -202,7 +202,6 @@
|
|||||||
"errors": {
|
"errors": {
|
||||||
"email-exists": "Já existe uma conta de usuário com este endereço de e-mail!"
|
"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.",
|
"minimum-age": "Tenho 18 anos ou mais.",
|
||||||
"submit": "Criar uma conta",
|
"submit": "Criar uma conta",
|
||||||
"success": "Um e-mail com um link para completar o seu registo foi enviado para <b>{email}</b>",
|
"success": "Um e-mail com um link para completar o seu registo foi enviado para <b>{email}</b>",
|
||||||
|
|||||||
@ -155,7 +155,6 @@
|
|||||||
"errors": {
|
"errors": {
|
||||||
"email-exists": "Уже есть учетная запись пользователя с этим адресом электронной почты!"
|
"email-exists": "Уже есть учетная запись пользователя с этим адресом электронной почты!"
|
||||||
},
|
},
|
||||||
"invitation-code": "Код приглашения: <b>{code}</b>",
|
|
||||||
"minimum-age": "Мне 18 лет или более",
|
"minimum-age": "Мне 18 лет или более",
|
||||||
"no-commercial": "У меня нет коммерческих намерений, и я не представляю коммерческое предприятие или организацию.",
|
"no-commercial": "У меня нет коммерческих намерений, и я не представляю коммерческое предприятие или организацию.",
|
||||||
"no-political": "Я не от имени какой-либо партии или политической организации в сети.",
|
"no-political": "Я не от имени какой-либо партии или политической организации в сети.",
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { config, mount } from '@vue/test-utils'
|
||||||
import Registration from './registration.vue'
|
import Registration from './registration.vue'
|
||||||
import Vuex from 'vuex'
|
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
@ -13,78 +12,14 @@ config.stubs['infinite-loading'] = '<span><slot /></span>'
|
|||||||
describe('Registration', () => {
|
describe('Registration', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
let Wrapper
|
let Wrapper
|
||||||
let store
|
|
||||||
let mocks
|
let mocks
|
||||||
let mutations
|
|
||||||
|
|
||||||
beforeEach(() => {
|
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 = {
|
mocks = {
|
||||||
$t: (key) => key,
|
$t: (key) => key,
|
||||||
$filters: {
|
|
||||||
truncate: (a) => a,
|
|
||||||
removeLinks: jest.fn(),
|
|
||||||
},
|
|
||||||
$i18n: {
|
$i18n: {
|
||||||
locale: () => 'de',
|
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: {
|
$route: {
|
||||||
query: {},
|
query: {},
|
||||||
},
|
},
|
||||||
@ -95,16 +30,11 @@ describe('Registration', () => {
|
|||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
Wrapper = () => {
|
Wrapper = () => {
|
||||||
return mount(Registration, {
|
return mount(Registration, {
|
||||||
store,
|
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wolle beforeEach(() => {
|
|
||||||
// wrapper = Wrapper()
|
|
||||||
// })
|
|
||||||
|
|
||||||
describe('no "PUBLIC_REGISTRATION" and no "INVITE_REGISTRATION"', () => {
|
describe('no "PUBLIC_REGISTRATION" and no "INVITE_REGISTRATION"', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks.$env = {
|
mocks.$env = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user