mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge pull request #1927 from Human-Connection/Set_and_save_language_in_user_settings
Language will be saved in the database of the user during registration
This commit is contained in:
commit
c819edc293
@ -109,4 +109,8 @@ module.exports = {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
locale: {
|
||||
type: 'string',
|
||||
allow: [null],
|
||||
},
|
||||
}
|
||||
|
||||
@ -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',
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ type Mutation {
|
||||
locationName: String
|
||||
about: String
|
||||
termsAndConditionsAgreedVersion: String!
|
||||
locale: String
|
||||
): User
|
||||
AddEmailAddress(email: String!): EmailAddress
|
||||
VerifyEmailAddress(
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 = {
|
||||
|
||||
@ -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({
|
||||
|
||||
@ -70,22 +70,24 @@
|
||||
:checked="termsAndConditionsConfirmed"
|
||||
/>
|
||||
<label
|
||||
for="checkbox"
|
||||
for="checkbox0"
|
||||
v-html="$t('termsAndConditions.termsAndConditionsConfirmed')"
|
||||
></label>
|
||||
</ds-text>
|
||||
<p>
|
||||
<label>
|
||||
<input id="checkbox1" type="checkbox" v-model="dataPrivacy" :checked="dataPrivacy" />
|
||||
<span v-html="$t('components.registration.signup.form.data-privacy')"></span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input id="checkbox2" type="checkbox" v-model="minimumAge" :checked="minimumAge" />
|
||||
<span v-html="$t('components.registration.signup.form.minimum-age')"></span>
|
||||
</label>
|
||||
</p>
|
||||
<ds-text>
|
||||
<input id="checkbox1" type="checkbox" v-model="dataPrivacy" :checked="dataPrivacy" />
|
||||
<label
|
||||
for="checkbox1"
|
||||
v-html="$t('components.registration.signup.form.data-privacy')"
|
||||
></label>
|
||||
</ds-text>
|
||||
<ds-text>
|
||||
<input id="checkbox2" type="checkbox" v-model="minimumAge" :checked="minimumAge" />
|
||||
<label
|
||||
for="checkbox2"
|
||||
v-html="$t('components.registration.signup.form.minimum-age')"
|
||||
></label>
|
||||
</ds-text>
|
||||
<ds-button
|
||||
style="float: right;"
|
||||
icon="check"
|
||||
@ -154,10 +156,19 @@ export default {
|
||||
const { name, password, about } = this.formData
|
||||
const { email, nonce } = this
|
||||
const termsAndConditionsAgreedVersion = VERSION
|
||||
const locale = this.$i18n.locale()
|
||||
try {
|
||||
await this.$apollo.mutate({
|
||||
mutation: SignupVerificationMutation,
|
||||
variables: { name, password, about, email, nonce, termsAndConditionsAgreedVersion },
|
||||
variables: {
|
||||
name,
|
||||
password,
|
||||
about,
|
||||
email,
|
||||
nonce,
|
||||
termsAndConditionsAgreedVersion,
|
||||
locale,
|
||||
},
|
||||
})
|
||||
this.response = 'success'
|
||||
setTimeout(() => {
|
||||
|
||||
@ -7,6 +7,7 @@ export const SignupVerificationMutation = gql`
|
||||
$password: String!
|
||||
$about: String
|
||||
$termsAndConditionsAgreedVersion: String!
|
||||
$locale: String
|
||||
) {
|
||||
SignupVerification(
|
||||
nonce: $nonce
|
||||
@ -15,6 +16,7 @@ export const SignupVerificationMutation = gql`
|
||||
password: $password
|
||||
about: $about
|
||||
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
|
||||
locale: $locale
|
||||
) {
|
||||
id
|
||||
name
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user