mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge pull request #2101 from Human-Connection/1747-show-shouts
1747 show shouts
This commit is contained in:
commit
735a31ed00
@ -127,6 +127,10 @@ module.exports = {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
showShoutsPublicly: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
locale: {
|
||||
type: 'string',
|
||||
allow: [null],
|
||||
|
||||
@ -177,6 +177,7 @@ export default {
|
||||
'termsAndConditionsAgreedVersion',
|
||||
'termsAndConditionsAgreedAt',
|
||||
'allowEmbedIframes',
|
||||
'showShoutsPublicly',
|
||||
'locale',
|
||||
],
|
||||
boolean: {
|
||||
|
||||
@ -28,6 +28,7 @@ type User {
|
||||
termsAndConditionsAgreedAt: String
|
||||
|
||||
allowEmbedIframes: Boolean
|
||||
showShoutsPublicly: Boolean
|
||||
locale: String
|
||||
friends: [User]! @relation(name: "FRIENDS", direction: "BOTH")
|
||||
friendsCount: Int! @cypher(statement: "MATCH (this)<-[: FRIENDS]->(r: User) RETURN COUNT(DISTINCT r)")
|
||||
@ -170,6 +171,8 @@ type Mutation {
|
||||
termsAndConditionsAgreedVersion: String
|
||||
termsAndConditionsAgreedAt: String
|
||||
allowEmbedIframes: Boolean
|
||||
showShoutsPublicly: Boolean
|
||||
|
||||
locale: String
|
||||
): User
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ export default function create() {
|
||||
termsAndConditionsAgreedVersion: '0.0.1',
|
||||
termsAndConditionsAgreedAt: '2019-08-01T10:47:19.212Z',
|
||||
allowEmbedIframes: false,
|
||||
showShoutsPublicly: false,
|
||||
locale: 'en',
|
||||
}
|
||||
defaults.slug = slugify(defaults.name, { lower: true })
|
||||
|
||||
@ -27,6 +27,7 @@ export default i18n => {
|
||||
id
|
||||
url
|
||||
}
|
||||
showShoutsPublicly
|
||||
}
|
||||
}
|
||||
`
|
||||
@ -148,6 +149,17 @@ export const allowEmbedIframesMutation = () => {
|
||||
`
|
||||
}
|
||||
|
||||
export const showShoutsPubliclyMutation = () => {
|
||||
return gql`
|
||||
mutation($id: ID!, $showShoutsPublicly: Boolean) {
|
||||
UpdateUser(id: $id, showShoutsPublicly: $showShoutsPublicly) {
|
||||
id
|
||||
showShoutsPublicly
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const checkSlugAvailableQuery = gql`
|
||||
query($slug: String!) {
|
||||
User(slug: $slug) {
|
||||
|
||||
@ -256,6 +256,11 @@
|
||||
"passwordStrength4": "Sehr sicheres Passwort"
|
||||
}
|
||||
},
|
||||
"privacy": {
|
||||
"name": "Privatsphäre",
|
||||
"make-shouts-public": "Teile von mir empfohlene Artikel öffentlich auf meinem Profil",
|
||||
"success-update": "Privatsphäre-Einstellungen gespeichert"
|
||||
},
|
||||
"invites": {
|
||||
"name": "Einladungen"
|
||||
},
|
||||
|
||||
@ -257,6 +257,11 @@
|
||||
"passwordStrength4": "Very strong password"
|
||||
}
|
||||
},
|
||||
"privacy": {
|
||||
"name": "Privacy",
|
||||
"make-shouts-public": "Share articles I have shouted on my public profile",
|
||||
"success-update": "Privacy settings saved"
|
||||
},
|
||||
"invites": {
|
||||
"name": "Invites"
|
||||
},
|
||||
|
||||
@ -259,6 +259,11 @@
|
||||
"passwordStrength4": "Senha muito forte"
|
||||
}
|
||||
},
|
||||
"privacy": {
|
||||
"name": "Privacidade",
|
||||
"make-shouts-public": "Compartilhar postagens que eu recomendei no meu perfil público",
|
||||
"success-update": "Configurações de privacidade salvas"
|
||||
},
|
||||
"invites": {
|
||||
"name": "Convites"
|
||||
},
|
||||
|
||||
@ -197,7 +197,7 @@
|
||||
<li
|
||||
class="Tabs__tab pointer"
|
||||
:class="{ active: tabActive === 'shout' }"
|
||||
v-if="myProfile"
|
||||
v-if="myProfile || user.showShoutsPublicly"
|
||||
>
|
||||
<a @click="handleTab('shout')">
|
||||
<ds-space margin="small">
|
||||
|
||||
@ -31,6 +31,10 @@ export default {
|
||||
name: this.$t('settings.security.name'),
|
||||
path: `/settings/security`,
|
||||
},
|
||||
{
|
||||
name: this.$t('settings.privacy.name'),
|
||||
path: 'settings/privacy',
|
||||
},
|
||||
{
|
||||
name: this.$t('settings.social-media.name'),
|
||||
path: `/settings/my-social-media`,
|
||||
|
||||
59
webapp/pages/settings/privacy.vue
Normal file
59
webapp/pages/settings/privacy.vue
Normal file
@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<ds-card :header="$t('settings.privacy.name')">
|
||||
<ds-space margin-bottom="small">
|
||||
<input id="allow-shouts" type="checkbox" v-model="shoutsAllowed" />
|
||||
<label for="allow-shouts">{{ $t('settings.privacy.make-shouts-public') }}</label>
|
||||
</ds-space>
|
||||
<ds-button primary @click="submit" :disabled="disabled">{{ $t('actions.save') }}</ds-button>
|
||||
</ds-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters, mapMutations } from 'vuex'
|
||||
import { showShoutsPubliclyMutation } from '~/graphql/User'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
shoutsAllowed: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
currentUser: 'auth/user',
|
||||
}),
|
||||
disabled() {
|
||||
return this.shoutsAllowed === this.currentUser.showShoutsPublicly
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.shoutsAllowed = this.currentUser.showShoutsPublicly || false
|
||||
},
|
||||
methods: {
|
||||
...mapMutations({
|
||||
setCurrentUser: 'auth/SET_USER',
|
||||
}),
|
||||
async submit() {
|
||||
try {
|
||||
await this.$apollo.mutate({
|
||||
mutation: showShoutsPubliclyMutation(),
|
||||
variables: {
|
||||
id: this.currentUser.id,
|
||||
showShoutsPublicly: this.shoutsAllowed,
|
||||
},
|
||||
update: (_, { data: { UpdateUser } }) => {
|
||||
const { showShoutsPublicly } = UpdateUser
|
||||
this.setCurrentUser({
|
||||
...this.currentUser,
|
||||
showShoutsPublicly,
|
||||
})
|
||||
this.$toast.success(this.$t('settings.privacy.success-update'))
|
||||
},
|
||||
})
|
||||
} catch (error) {
|
||||
this.$toast.error(error.message)
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@ -88,6 +88,7 @@ export const actions = {
|
||||
contributionsCount
|
||||
commentedCount
|
||||
allowEmbedIframes
|
||||
showShoutsPublicly
|
||||
termsAndConditionsAgreedVersion
|
||||
socialMedia {
|
||||
id
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user