mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
add better seed for group myRole
This commit is contained in:
parent
99d2ce9d29
commit
fe6ad2cff3
@ -325,13 +325,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
userId: 'u2',
|
||||
},
|
||||
}),
|
||||
mutate({
|
||||
mutation: joinGroupMutation,
|
||||
variables: {
|
||||
groupId: 'g0',
|
||||
userId: 'u3',
|
||||
},
|
||||
}),
|
||||
mutate({
|
||||
mutation: joinGroupMutation,
|
||||
variables: {
|
||||
@ -364,14 +357,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
roleInGroup: 'admin',
|
||||
},
|
||||
}),
|
||||
mutate({
|
||||
mutation: changeGroupMemberRoleMutation,
|
||||
variables: {
|
||||
groupId: 'g0',
|
||||
userId: 'u3',
|
||||
roleInGroup: 'owner',
|
||||
},
|
||||
}),
|
||||
])
|
||||
|
||||
authenticatedUser = await jennyRostock.toJson()
|
||||
@ -430,7 +415,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
mutate({
|
||||
mutation: changeGroupMemberRoleMutation,
|
||||
variables: {
|
||||
groupId: 'g0',
|
||||
groupId: 'g1',
|
||||
userId: 'u1',
|
||||
roleInGroup: 'usual',
|
||||
},
|
||||
@ -438,15 +423,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
mutate({
|
||||
mutation: changeGroupMemberRoleMutation,
|
||||
variables: {
|
||||
groupId: 'g0',
|
||||
userId: 'u2',
|
||||
roleInGroup: 'usual',
|
||||
},
|
||||
}),
|
||||
mutate({
|
||||
mutation: changeGroupMemberRoleMutation,
|
||||
variables: {
|
||||
groupId: 'g0',
|
||||
groupId: 'g1',
|
||||
userId: 'u5',
|
||||
roleInGroup: 'admin',
|
||||
},
|
||||
@ -454,7 +431,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
mutate({
|
||||
mutation: changeGroupMemberRoleMutation,
|
||||
variables: {
|
||||
groupId: 'g0',
|
||||
groupId: 'g1',
|
||||
userId: 'u6',
|
||||
roleInGroup: 'owner',
|
||||
},
|
||||
@ -477,6 +454,13 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
}),
|
||||
])
|
||||
await Promise.all([
|
||||
mutate({
|
||||
mutation: joinGroupMutation,
|
||||
variables: {
|
||||
groupId: 'g2',
|
||||
userId: 'u3',
|
||||
},
|
||||
}),
|
||||
mutate({
|
||||
mutation: joinGroupMutation,
|
||||
variables: {
|
||||
@ -510,7 +494,15 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
mutate({
|
||||
mutation: changeGroupMemberRoleMutation,
|
||||
variables: {
|
||||
groupId: 'g0',
|
||||
groupId: 'g2',
|
||||
userId: 'u3',
|
||||
roleInGroup: 'pending',
|
||||
},
|
||||
}),
|
||||
mutate({
|
||||
mutation: changeGroupMemberRoleMutation,
|
||||
variables: {
|
||||
groupId: 'g2',
|
||||
userId: 'u4',
|
||||
roleInGroup: 'usual',
|
||||
},
|
||||
@ -518,7 +510,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
mutate({
|
||||
mutation: changeGroupMemberRoleMutation,
|
||||
variables: {
|
||||
groupId: 'g0',
|
||||
groupId: 'g2',
|
||||
userId: 'u5',
|
||||
roleInGroup: 'usual',
|
||||
},
|
||||
@ -526,7 +518,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
mutate({
|
||||
mutation: changeGroupMemberRoleMutation,
|
||||
variables: {
|
||||
groupId: 'g0',
|
||||
groupId: 'g2',
|
||||
userId: 'u6',
|
||||
roleInGroup: 'usual',
|
||||
},
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<ds-container>
|
||||
update: {{update}}
|
||||
update: {{ update }}
|
||||
<ds-form
|
||||
class="group-form"
|
||||
ref="groupForm"
|
||||
@ -23,11 +23,7 @@
|
||||
placeholder="Status ..."
|
||||
></ds-select>
|
||||
|
||||
<ds-input
|
||||
v-model="formData.about"
|
||||
label="Kurzbeschreibung"
|
||||
rows="3"
|
||||
></ds-input>
|
||||
<ds-input v-model="formData.about" label="Kurzbeschreibung" rows="3"></ds-input>
|
||||
|
||||
<ds-input
|
||||
v-model="formData.description"
|
||||
@ -61,7 +57,7 @@
|
||||
:disabled="disabled"
|
||||
primary
|
||||
>
|
||||
{{update ? $t('group.update') : $t('group.save')}}
|
||||
{{ update ? $t('group.update') : $t('group.save') }}
|
||||
</ds-button>
|
||||
</ds-space>
|
||||
</ds-form>
|
||||
@ -93,7 +89,7 @@ export default {
|
||||
},
|
||||
},
|
||||
data() {
|
||||
const { name, groupType, about, description, actionRadius, categories } = this.groupData
|
||||
const { name, groupType, about, description, actionRadius, categories } = this.group
|
||||
return {
|
||||
categoriesActive: this.$env.CATEGORIES_ACTIVE,
|
||||
disabled: false,
|
||||
@ -128,7 +124,9 @@ export default {
|
||||
methods: {
|
||||
submit() {
|
||||
console.log('submit', this.formData)
|
||||
this.update ? this.$emit('updateGroup', this.formData) : this.$emit('createGroup', this.formData)
|
||||
this.update
|
||||
? this.$emit('updateGroup', this.formData)
|
||||
: this.$emit('createGroup', this.formData)
|
||||
},
|
||||
reset() {
|
||||
console.log('reset')
|
||||
|
||||
@ -5,21 +5,23 @@
|
||||
<ds-table :data="items" :fields="fields">
|
||||
<template slot="delete" slot-scope="scope">
|
||||
<base-button
|
||||
v-if="scope.row.owner"
|
||||
v-if="scope.row.myRole === 'owner'"
|
||||
icon="trash"
|
||||
@click="deleteGroup(scope.row)"
|
||||
></base-button>
|
||||
</template>
|
||||
<template slot="name" slot-scope="scope">
|
||||
<nuxt-link :to="`/group/g1/${scope.row.name}`">{{ scope.row.name }}</nuxt-link>
|
||||
<small>{{scope.row}}</small>
|
||||
<small>{{ scope.row }}</small>
|
||||
</template>
|
||||
<template slot="categories" slot-scope="scope">
|
||||
<ds-tag v-for="categorie in scope.row.categories" :key="categorie.id" color="primary">{{ categorie.name }}</ds-tag>
|
||||
<ds-tag v-for="categorie in scope.row.categories" :key="categorie.id" color="primary">
|
||||
{{ categorie.name }}
|
||||
</ds-tag>
|
||||
</template>
|
||||
<template slot="edit" slot-scope="scope">
|
||||
<base-button
|
||||
v-if="!scope.row.owner"
|
||||
v-if="scope.row.myRole === 'owner'"
|
||||
icon="edit"
|
||||
@click="editGroup(scope.row)"
|
||||
></base-button>
|
||||
@ -30,11 +32,15 @@
|
||||
</template>
|
||||
<template slot="unfollow" slot-scope="scope">
|
||||
<base-button
|
||||
:disabled="!scope.row.owner ? 'disable' : false"
|
||||
v-if="!scope.row.owner"
|
||||
v-if="scope.row.myRole === 'usual'"
|
||||
icon="close"
|
||||
@click="unfollowGroup(scope.row)"
|
||||
></base-button>
|
||||
<base-button
|
||||
v-if="scope.row.myRole === null"
|
||||
icon="plus"
|
||||
@click="addMemeberToGroup(scope.row)"
|
||||
></base-button>
|
||||
</template>
|
||||
</ds-table>
|
||||
</ds-container>
|
||||
@ -58,6 +64,9 @@ export default {
|
||||
unfollowGroup() {
|
||||
alert('unfollow group')
|
||||
},
|
||||
addMemeberToGroup() {
|
||||
alert('addMemeberToGroup group')
|
||||
},
|
||||
},
|
||||
computed: {},
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ import gql from 'graphql-tag'
|
||||
// ------ mutations
|
||||
|
||||
export const createGroupMutation = gql`
|
||||
mutation(
|
||||
mutation (
|
||||
$id: ID
|
||||
$name: String!
|
||||
$slug: String
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
<template>
|
||||
<ds-flex gutter="small">
|
||||
{{$router}}
|
||||
<ds-flex-item :width="{ base: '100%', md: '200px' }">
|
||||
<ds-menu :routes="routes" :is-exact="() => true" />
|
||||
</ds-flex-item>
|
||||
<ds-flex-item :width="{ base: '100%', md: 1 }">
|
||||
{{group}}
|
||||
<transition name="slide-up" appear>
|
||||
<group-form @updateGroup="updateGroup" :group="group" :update="true"/>
|
||||
</transition>
|
||||
</ds-flex-item>
|
||||
</ds-flex>
|
||||
{{ $router }}
|
||||
<ds-flex-item :width="{ base: '100%', md: '200px' }">
|
||||
<ds-menu :routes="routes" :is-exact="() => true" />
|
||||
</ds-flex-item>
|
||||
<ds-flex-item :width="{ base: '100%', md: 1 }">
|
||||
{{ group }}
|
||||
<transition name="slide-up" appear>
|
||||
<group-form @updateGroup="updateGroup" :group="group" :update="true" />
|
||||
</transition>
|
||||
</ds-flex-item>
|
||||
</ds-flex>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -41,16 +41,14 @@ export default {
|
||||
name: 'invite link',
|
||||
path: ``,
|
||||
},
|
||||
]},
|
||||
]
|
||||
},
|
||||
...mapGetters({
|
||||
user: 'auth/user',
|
||||
}),
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
groupData: {},
|
||||
}
|
||||
return {}
|
||||
},
|
||||
async asyncData(context) {
|
||||
console.log('asyncData start')
|
||||
@ -70,21 +68,22 @@ export default {
|
||||
})
|
||||
console.log('asyncData group', group)
|
||||
console.log('asyncData id', id)
|
||||
console.log('asyncData group.myRole', group.myRole)
|
||||
if (group.myRole !== 'owner') {
|
||||
error({ statusCode: 403, message: 'NONONNNO' })
|
||||
}
|
||||
return { group }
|
||||
return { group }
|
||||
},
|
||||
methods: {
|
||||
async updateGroup(form, context) {
|
||||
const {
|
||||
params: { id },
|
||||
} = context
|
||||
async updateGroup(form, context) {
|
||||
const {
|
||||
params: { id },
|
||||
} = context
|
||||
try {
|
||||
await this.$apollo.mutate({
|
||||
mutation: updateGroupMutation,
|
||||
variables: {
|
||||
id: params,
|
||||
id: id,
|
||||
name: form.name,
|
||||
about: form.about,
|
||||
description: form.description,
|
||||
@ -107,6 +106,6 @@ export default {
|
||||
this.$toast.error(error.message)
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -16,8 +16,9 @@ import { groupQuery } from '~/graphql/groups.js'
|
||||
|
||||
/*
|
||||
*
|
||||
* gruppen status: { open, close, hidden }
|
||||
*
|
||||
* groupType: { public, closed, hidden }
|
||||
* myRole: { pending, usual, admin, owner }
|
||||
* actionRadius { regional, national, continental, global, interplanetary
|
||||
*
|
||||
*/
|
||||
export default {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user