Set language will be saved in the database of the user during registration

This commit is contained in:
ogerly 2019-10-16 15:01:07 +02:00
parent 452bf4127c
commit 97dad41b27
7 changed files with 14 additions and 1 deletions

View File

@ -108,5 +108,9 @@ module.exports = {
allowEmbedIframes: { allowEmbedIframes: {
type: 'boolean', type: 'boolean',
default: false, default: false,
},
language: {
type: 'string',
allow: [null],
}, },
} }

View File

@ -19,6 +19,7 @@ type Mutation {
locationName: String locationName: String
about: String about: String
termsAndConditionsAgreedVersion: String! termsAndConditionsAgreedVersion: String!
language: String
): User ): User
AddEmailAddress(email: String!): EmailAddress AddEmailAddress(email: String!): EmailAddress
VerifyEmailAddress( VerifyEmailAddress(

View File

@ -29,6 +29,8 @@ type User {
allowEmbedIframes: Boolean allowEmbedIframes: Boolean
language: String
friends: [User]! @relation(name: "FRIENDS", direction: "BOTH") friends: [User]! @relation(name: "FRIENDS", direction: "BOTH")
friendsCount: Int! @cypher(statement: "MATCH (this)<-[: FRIENDS]->(r: User) RETURN COUNT(DISTINCT r)") friendsCount: Int! @cypher(statement: "MATCH (this)<-[: FRIENDS]->(r: User) RETURN COUNT(DISTINCT r)")
@ -169,6 +171,7 @@ type Mutation {
termsAndConditionsAgreedVersion: String termsAndConditionsAgreedVersion: String
termsAndConditionsAgreedAt: String termsAndConditionsAgreedAt: String
allowEmbedIframes: Boolean allowEmbedIframes: Boolean
language: String
): User ): User
DeleteUser(id: ID!, resource: [Deletable]): User DeleteUser(id: ID!, resource: [Deletable]): User

View File

@ -17,6 +17,7 @@ export default function create() {
termsAndConditionsAgreedVersion: '0.0.1', termsAndConditionsAgreedVersion: '0.0.1',
termsAndConditionsAgreedAt: '2019-08-01T10:47:19.212Z', termsAndConditionsAgreedAt: '2019-08-01T10:47:19.212Z',
allowEmbedIframes: false, allowEmbedIframes: false,
language: 'en',
} }
defaults.slug = slugify(defaults.name, { lower: true }) defaults.slug = slugify(defaults.name, { lower: true })
args = { args = {

View File

@ -85,6 +85,7 @@ describe('CreateUserAccount', () => {
nonce: '666777', nonce: '666777',
password: 'hellopassword', password: 'hellopassword',
termsAndConditionsAgreedVersion: '0.0.2', termsAndConditionsAgreedVersion: '0.0.2',
language: 'en',
}, },
}) })
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected)

View File

@ -154,10 +154,11 @@ export default {
const { name, password, about } = this.formData const { name, password, about } = this.formData
const { email, nonce } = this const { email, nonce } = this
const termsAndConditionsAgreedVersion = VERSION const termsAndConditionsAgreedVersion = VERSION
const language = this.$i18n.locale()
try { try {
await this.$apollo.mutate({ await this.$apollo.mutate({
mutation: SignupVerificationMutation, mutation: SignupVerificationMutation,
variables: { name, password, about, email, nonce, termsAndConditionsAgreedVersion }, variables: { name, password, about, email, nonce, termsAndConditionsAgreedVersion, language },
}) })
this.response = 'success' this.response = 'success'
setTimeout(() => { setTimeout(() => {

View File

@ -7,6 +7,7 @@ export const SignupVerificationMutation = gql`
$password: String! $password: String!
$about: String $about: String
$termsAndConditionsAgreedVersion: String! $termsAndConditionsAgreedVersion: String!
$language: String
) { ) {
SignupVerification( SignupVerification(
nonce: $nonce nonce: $nonce
@ -15,6 +16,7 @@ export const SignupVerificationMutation = gql`
password: $password password: $password
about: $about about: $about
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
language: $language
) { ) {
id id
name name