diff --git a/backend/src/models/User.js b/backend/src/models/User.js index 86900c3ae..ece678a1f 100644 --- a/backend/src/models/User.js +++ b/backend/src/models/User.js @@ -109,4 +109,8 @@ module.exports = { type: 'boolean', default: false, }, + locale: { + type: 'string', + allow: [null], + }, } diff --git a/backend/src/schema/resolvers/registration.spec.js b/backend/src/schema/resolvers/registration.spec.js index 0f3af5a8d..c2b83324d 100644 --- a/backend/src/schema/resolvers/registration.spec.js +++ b/backend/src/schema/resolvers/registration.spec.js @@ -381,6 +381,7 @@ describe('SignupVerification', () => { $nonce: String! $about: String $termsAndConditionsAgreedVersion: String! + $locale: String ) { SignupVerification( name: $name @@ -389,6 +390,7 @@ describe('SignupVerification', () => { nonce: $nonce about: $about termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion + locale: $locale ) { id termsAndConditionsAgreedVersion @@ -405,6 +407,7 @@ describe('SignupVerification', () => { password: '123', email: 'john@example.org', termsAndConditionsAgreedVersion: '0.1.0', + locale: 'en', } }) diff --git a/backend/src/schema/types/type/EmailAddress.gql b/backend/src/schema/types/type/EmailAddress.gql index 1748139bd..99e309602 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! + locale: 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..1f46dc6cd 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 + locale: 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 + locale: 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..99e2681c9 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, + locale: '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..fb9bf00f8 100644 --- a/webapp/components/Registration/CreateUserAccount.spec.js +++ b/webapp/components/Registration/CreateUserAccount.spec.js @@ -24,6 +24,9 @@ describe('CreateUserAccount', () => { loading: false, mutate: jest.fn(), }, + $i18n: { + locale: () => 'en', + }, } propsData = {} stubs = { @@ -69,12 +72,6 @@ describe('CreateUserAccount', () => { } }) - it('calls CreateUserAccount graphql mutation', async () => { - await action() - const expected = expect.objectContaining({ mutation: SignupVerificationMutation }) - expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) - }) - it('delivers data to backend', async () => { await action() const expected = expect.objectContaining({ @@ -85,11 +82,18 @@ describe('CreateUserAccount', () => { nonce: '666777', password: 'hellopassword', termsAndConditionsAgreedVersion: '0.0.2', + locale: 'en', }, }) expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) }) + it('calls CreateUserAccount graphql mutation', async () => { + await action() + const expected = expect.objectContaining({ mutation: SignupVerificationMutation }) + expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) + }) + describe('in case mutation resolves', () => { beforeEach(() => { mocks.$apollo.mutate = jest.fn().mockResolvedValue({ diff --git a/webapp/components/Registration/CreateUserAccount.vue b/webapp/components/Registration/CreateUserAccount.vue index 7fc64a545..00466a2d3 100644 --- a/webapp/components/Registration/CreateUserAccount.vue +++ b/webapp/components/Registration/CreateUserAccount.vue @@ -70,22 +70,24 @@ :checked="termsAndConditionsConfirmed" /> -
- -
-- -
+