mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-12 23:35:52 +00:00
fix broken observe on post (#8610)
Due to missing tests & problematic refactoring, posts could no longer be observed and the new observe state beeing indicated without reloading the page. This reverts parts of https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8598 to fix the problem
This commit is contained in:
parent
4b3a26d517
commit
16803e45e6
@ -167,6 +167,7 @@ import {
|
|||||||
} from '~/components/utils/PostHelpers'
|
} from '~/components/utils/PostHelpers'
|
||||||
import PostQuery from '~/graphql/PostQuery'
|
import PostQuery from '~/graphql/PostQuery'
|
||||||
import { groupQuery } from '~/graphql/groups'
|
import { groupQuery } from '~/graphql/groups'
|
||||||
|
import PostMutations from '~/graphql/PostMutations'
|
||||||
import links from '~/constants/links.js'
|
import links from '~/constants/links.js'
|
||||||
import GetCategories from '~/mixins/getCategoriesMixin.js'
|
import GetCategories from '~/mixins/getCategoriesMixin.js'
|
||||||
import postListActions from '~/mixins/postListActions'
|
import postListActions from '~/mixins/postListActions'
|
||||||
@ -308,6 +309,24 @@ export default {
|
|||||||
this.post.isObservedByMe = comment.isPostObservedByMe
|
this.post.isObservedByMe = comment.isPostObservedByMe
|
||||||
this.post.observingUsersCount = comment.postObservingUsersCount
|
this.post.observingUsersCount = comment.postObservingUsersCount
|
||||||
},
|
},
|
||||||
|
toggleObservePost(postId, value) {
|
||||||
|
this.$apollo
|
||||||
|
.mutate({
|
||||||
|
mutation: PostMutations().toggleObservePost,
|
||||||
|
variables: {
|
||||||
|
value,
|
||||||
|
id: postId,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
const message = this.$t(
|
||||||
|
`post.menu.${value ? 'observedSuccessfully' : 'unobservedSuccessfully'}`,
|
||||||
|
)
|
||||||
|
this.$toast.success(message)
|
||||||
|
this.$apollo.queries.Post.refetch()
|
||||||
|
})
|
||||||
|
.catch((error) => this.$toast.error(error.message))
|
||||||
|
},
|
||||||
toggleNewCommentForm(showNewCommentForm) {
|
toggleNewCommentForm(showNewCommentForm) {
|
||||||
this.showNewCommentForm = showNewCommentForm
|
this.showNewCommentForm = showNewCommentForm
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user