mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
add EditCommentForm spec.js
This commit is contained in:
parent
5e9f46405e
commit
912b94d43c
@ -74,9 +74,6 @@ export default {
|
||||
session.close()
|
||||
return commentReturnedWithAuthor
|
||||
},
|
||||
UpdateComment: async (object, params, context, resolveInfo) => {
|
||||
await neo4jgraphql(object, params, context, resolveInfo, false)
|
||||
},
|
||||
DeleteComment: async (object, params, context, resolveInfo) => {
|
||||
const comment = await neo4jgraphql(object, params, context, resolveInfo, false)
|
||||
|
||||
|
||||
@ -9,7 +9,10 @@
|
||||
color="primary"
|
||||
size="small"
|
||||
round
|
||||
>{{ comments.length }}</ds-tag> Comments
|
||||
>
|
||||
{{ comments.length }}
|
||||
</ds-tag>
|
||||
Comments
|
||||
</span>
|
||||
</h3>
|
||||
<ds-space margin-bottom="large" />
|
||||
|
||||
@ -14,15 +14,14 @@
|
||||
ghost
|
||||
class="cancelBtn"
|
||||
@click.prevent="closeEditWindow"
|
||||
>{{ $t('actions.cancel') }}</ds-button>
|
||||
>
|
||||
{{ $t('actions.cancel') }}
|
||||
</ds-button>
|
||||
</ds-flex-item>
|
||||
<ds-flex-item :width="{ base: '40%', md: '20%', sm: '40%', xs: '40%' }">
|
||||
<ds-button
|
||||
type="submit"
|
||||
:loading="loading"
|
||||
:disabled="disabled || errors"
|
||||
primary
|
||||
>{{ $t('post.comment.submit') }}</ds-button>
|
||||
<ds-button type="submit" :loading="loading" :disabled="disabled || errors" primary>
|
||||
{{ $t('post.comment.submit') }}
|
||||
</ds-button>
|
||||
</ds-flex-item>
|
||||
</ds-flex>
|
||||
</ds-card>
|
||||
@ -36,26 +35,24 @@ import HcEditor from '~/components/Editor'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HcEditor
|
||||
HcEditor,
|
||||
},
|
||||
props: {
|
||||
post: { type: Object, default: () => {} },
|
||||
comments: { type: Array, default: () => [] },
|
||||
comment: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
disabled: false,
|
||||
loading: false,
|
||||
form: {
|
||||
content: this.comment.contentExcerpt
|
||||
content: this.comment.contentExcerpt,
|
||||
},
|
||||
users: []
|
||||
users: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -77,22 +74,21 @@ export default {
|
||||
this.$apollo
|
||||
.mutate({
|
||||
mutation: gql`
|
||||
mutation($postId: ID, $content: String!, $id: ID!) {
|
||||
UpdateComment(postId: $postId, content: $content, id: $id) {
|
||||
mutation($content: String!, $id: ID!) {
|
||||
UpdateComment(content: $content, id: $id) {
|
||||
id
|
||||
content
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
postId: this.post.id,
|
||||
content: this.form.content,
|
||||
id: this.comment.id
|
||||
}
|
||||
id: this.comment.id,
|
||||
},
|
||||
})
|
||||
.then(res => {
|
||||
this.loading = false
|
||||
this.$root.$emit('refetchPostComments')
|
||||
|
||||
this.$toast.success(this.$t('post.comment.updated'))
|
||||
this.disabled = false
|
||||
this.$emit('showEditCommentMenu', false)
|
||||
@ -100,7 +96,7 @@ export default {
|
||||
.catch(err => {
|
||||
this.$toast.error(err.message)
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
apollo: {
|
||||
User: {
|
||||
@ -114,8 +110,8 @@ export default {
|
||||
},
|
||||
result(result) {
|
||||
this.users = result.data.User
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user