diff --git a/backend/src/models/User.js b/backend/src/models/User.js index 86900c3ae..55dc95609 100644 --- a/backend/src/models/User.js +++ b/backend/src/models/User.js @@ -108,5 +108,9 @@ module.exports = { allowEmbedIframes: { type: 'boolean', default: false, + }, + language: { + type: 'string', + allow: [null], }, } diff --git a/backend/src/schema/types/type/EmailAddress.gql b/backend/src/schema/types/type/EmailAddress.gql index 1748139bd..f338e019f 100644 --- a/backend/src/schema/types/type/EmailAddress.gql +++ b/backend/src/schema/types/type/EmailAddress.gql @@ -19,6 +19,7 @@ type Mutation { locationName: String about: String termsAndConditionsAgreedVersion: String! + language: String ): User AddEmailAddress(email: String!): EmailAddress VerifyEmailAddress( diff --git a/backend/src/schema/types/type/User.gql b/backend/src/schema/types/type/User.gql index d9084dd90..51a507670 100644 --- a/backend/src/schema/types/type/User.gql +++ b/backend/src/schema/types/type/User.gql @@ -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 diff --git a/backend/src/seed/factories/users.js b/backend/src/seed/factories/users.js index b65be795d..70d626c62 100644 --- a/backend/src/seed/factories/users.js +++ b/backend/src/seed/factories/users.js @@ -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 = { diff --git a/webapp/components/Registration/CreateUserAccount.spec.js b/webapp/components/Registration/CreateUserAccount.spec.js index 3bea5a975..5909d616c 100644 --- a/webapp/components/Registration/CreateUserAccount.spec.js +++ b/webapp/components/Registration/CreateUserAccount.spec.js @@ -85,6 +85,7 @@ describe('CreateUserAccount', () => { nonce: '666777', password: 'hellopassword', termsAndConditionsAgreedVersion: '0.0.2', + language: 'en', }, }) expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) diff --git a/webapp/components/Registration/CreateUserAccount.vue b/webapp/components/Registration/CreateUserAccount.vue index 7fc64a545..745278fa3 100644 --- a/webapp/components/Registration/CreateUserAccount.vue +++ b/webapp/components/Registration/CreateUserAccount.vue @@ -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(() => { diff --git a/webapp/graphql/Registration.js b/webapp/graphql/Registration.js index 4a24f626a..eab2b94be 100644 --- a/webapp/graphql/Registration.js +++ b/webapp/graphql/Registration.js @@ -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