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',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
locale: {
|
||||||
|
type: 'string',
|
||||||
|
allow: [null],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -381,6 +381,7 @@ describe('SignupVerification', () => {
|
|||||||
$nonce: String!
|
$nonce: String!
|
||||||
$about: String
|
$about: String
|
||||||
$termsAndConditionsAgreedVersion: String!
|
$termsAndConditionsAgreedVersion: String!
|
||||||
|
$locale: String
|
||||||
) {
|
) {
|
||||||
SignupVerification(
|
SignupVerification(
|
||||||
name: $name
|
name: $name
|
||||||
@ -389,6 +390,7 @@ describe('SignupVerification', () => {
|
|||||||
nonce: $nonce
|
nonce: $nonce
|
||||||
about: $about
|
about: $about
|
||||||
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
|
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
|
||||||
|
locale: $locale
|
||||||
) {
|
) {
|
||||||
id
|
id
|
||||||
termsAndConditionsAgreedVersion
|
termsAndConditionsAgreedVersion
|
||||||
@ -405,6 +407,7 @@ describe('SignupVerification', () => {
|
|||||||
password: '123',
|
password: '123',
|
||||||
email: 'john@example.org',
|
email: 'john@example.org',
|
||||||
termsAndConditionsAgreedVersion: '0.1.0',
|
termsAndConditionsAgreedVersion: '0.1.0',
|
||||||
|
locale: 'en',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ type Mutation {
|
|||||||
locationName: String
|
locationName: String
|
||||||
about: String
|
about: String
|
||||||
termsAndConditionsAgreedVersion: String!
|
termsAndConditionsAgreedVersion: String!
|
||||||
|
locale: String
|
||||||
): User
|
): User
|
||||||
AddEmailAddress(email: String!): EmailAddress
|
AddEmailAddress(email: String!): EmailAddress
|
||||||
VerifyEmailAddress(
|
VerifyEmailAddress(
|
||||||
|
|||||||
@ -29,6 +29,8 @@ type User {
|
|||||||
|
|
||||||
allowEmbedIframes: Boolean
|
allowEmbedIframes: Boolean
|
||||||
|
|
||||||
|
locale: 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
|
||||||
|
locale: String
|
||||||
): User
|
): User
|
||||||
|
|
||||||
DeleteUser(id: ID!, resource: [Deletable]): User
|
DeleteUser(id: ID!, resource: [Deletable]): User
|
||||||
|
|||||||
@ -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,
|
||||||
|
locale: 'en',
|
||||||
}
|
}
|
||||||
defaults.slug = slugify(defaults.name, { lower: true })
|
defaults.slug = slugify(defaults.name, { lower: true })
|
||||||
args = {
|
args = {
|
||||||
|
|||||||
@ -24,6 +24,9 @@ describe('CreateUserAccount', () => {
|
|||||||
loading: false,
|
loading: false,
|
||||||
mutate: jest.fn(),
|
mutate: jest.fn(),
|
||||||
},
|
},
|
||||||
|
$i18n: {
|
||||||
|
locale: () => 'en',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
propsData = {}
|
propsData = {}
|
||||||
stubs = {
|
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 () => {
|
it('delivers data to backend', async () => {
|
||||||
await action()
|
await action()
|
||||||
const expected = expect.objectContaining({
|
const expected = expect.objectContaining({
|
||||||
@ -85,11 +82,18 @@ describe('CreateUserAccount', () => {
|
|||||||
nonce: '666777',
|
nonce: '666777',
|
||||||
password: 'hellopassword',
|
password: 'hellopassword',
|
||||||
termsAndConditionsAgreedVersion: '0.0.2',
|
termsAndConditionsAgreedVersion: '0.0.2',
|
||||||
|
locale: 'en',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected)
|
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', () => {
|
describe('in case mutation resolves', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks.$apollo.mutate = jest.fn().mockResolvedValue({
|
mocks.$apollo.mutate = jest.fn().mockResolvedValue({
|
||||||
|
|||||||
@ -70,22 +70,24 @@
|
|||||||
:checked="termsAndConditionsConfirmed"
|
:checked="termsAndConditionsConfirmed"
|
||||||
/>
|
/>
|
||||||
<label
|
<label
|
||||||
for="checkbox"
|
for="checkbox0"
|
||||||
v-html="$t('termsAndConditions.termsAndConditionsConfirmed')"
|
v-html="$t('termsAndConditions.termsAndConditionsConfirmed')"
|
||||||
></label>
|
></label>
|
||||||
</ds-text>
|
</ds-text>
|
||||||
<p>
|
<ds-text>
|
||||||
<label>
|
|
||||||
<input id="checkbox1" type="checkbox" v-model="dataPrivacy" :checked="dataPrivacy" />
|
<input id="checkbox1" type="checkbox" v-model="dataPrivacy" :checked="dataPrivacy" />
|
||||||
<span v-html="$t('components.registration.signup.form.data-privacy')"></span>
|
<label
|
||||||
</label>
|
for="checkbox1"
|
||||||
</p>
|
v-html="$t('components.registration.signup.form.data-privacy')"
|
||||||
<p>
|
></label>
|
||||||
<label>
|
</ds-text>
|
||||||
|
<ds-text>
|
||||||
<input id="checkbox2" type="checkbox" v-model="minimumAge" :checked="minimumAge" />
|
<input id="checkbox2" type="checkbox" v-model="minimumAge" :checked="minimumAge" />
|
||||||
<span v-html="$t('components.registration.signup.form.minimum-age')"></span>
|
<label
|
||||||
</label>
|
for="checkbox2"
|
||||||
</p>
|
v-html="$t('components.registration.signup.form.minimum-age')"
|
||||||
|
></label>
|
||||||
|
</ds-text>
|
||||||
<ds-button
|
<ds-button
|
||||||
style="float: right;"
|
style="float: right;"
|
||||||
icon="check"
|
icon="check"
|
||||||
@ -154,10 +156,19 @@ 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 locale = 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,
|
||||||
|
locale,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
this.response = 'success'
|
this.response = 'success'
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@ -7,6 +7,7 @@ export const SignupVerificationMutation = gql`
|
|||||||
$password: String!
|
$password: String!
|
||||||
$about: String
|
$about: String
|
||||||
$termsAndConditionsAgreedVersion: String!
|
$termsAndConditionsAgreedVersion: String!
|
||||||
|
$locale: 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
|
||||||
|
locale: $locale
|
||||||
) {
|
) {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user