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: {
type: 'boolean',
default: false,
},
language: {
type: 'string',
allow: [null],
},
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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