mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-04-27 15:09:13 +00:00
Investigation how to update the Comments List intelligent
This commit is contained in:
parent
a9617c8b62
commit
8033556145
@ -19,6 +19,7 @@
|
|||||||
<content-menu
|
<content-menu
|
||||||
placement="bottom-end"
|
placement="bottom-end"
|
||||||
resource-type="comment"
|
resource-type="comment"
|
||||||
|
:deleteCallback="deleteCallback"
|
||||||
:resource="comment"
|
:resource="comment"
|
||||||
style="float-right"
|
style="float-right"
|
||||||
:is-owner="isAuthor(author.id)"
|
:is-owner="isAuthor(author.id)"
|
||||||
@ -69,6 +70,9 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
isAuthor(id) {
|
isAuthor(id) {
|
||||||
return this.user.id === id
|
return this.user.id === id
|
||||||
|
},
|
||||||
|
deleteCallback() {
|
||||||
|
console.log('"deleteCallback" was called !!!')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
v-if="open === 'delete'"
|
v-if="open === 'delete'"
|
||||||
:id="data.resource.id"
|
:id="data.resource.id"
|
||||||
:type="data.type"
|
:type="data.type"
|
||||||
|
:deleteCallback="deleteCallback"
|
||||||
:name="name"
|
:name="name"
|
||||||
@close="close"
|
@close="close"
|
||||||
/>
|
/>
|
||||||
@ -37,6 +38,10 @@ export default {
|
|||||||
ReportModal,
|
ReportModal,
|
||||||
DeleteModal
|
DeleteModal
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
deleteCallback: { type: Function, required: true },
|
||||||
|
cancelCallback: { type: Function, default: null }
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
data: 'modal/data',
|
data: 'modal/data',
|
||||||
|
|||||||
@ -53,6 +53,8 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
name: { type: String, default: '' },
|
name: { type: String, default: '' },
|
||||||
type: { type: String, required: true },
|
type: { type: String, required: true },
|
||||||
|
deleteCallback: { type: Function, required: true },
|
||||||
|
cancelCallback: { type: Function, default: null },
|
||||||
id: { type: String, required: true }
|
id: { type: String, required: true }
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -116,12 +118,23 @@ export default {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.success = false
|
this.success = false
|
||||||
this.$emit('close')
|
this.$emit('close')
|
||||||
if (this.$router.history.current.name === 'post-id-slug') {
|
switch (this.type) {
|
||||||
// redirect to index
|
case 'contribution':
|
||||||
this.$router.history.push('/')
|
if (this.$router.history.current.name === 'post-id-slug') {
|
||||||
} else {
|
// redirect to index
|
||||||
// reload the page (when deleting from profile or index)
|
this.$router.history.push('/')
|
||||||
window.location.assign(window.location.href)
|
} else {
|
||||||
|
// reload the page (when deleting from profile or index)
|
||||||
|
window.location.assign(window.location.href)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'comment':
|
||||||
|
// reload the page
|
||||||
|
// window.location.assign(window.location.href)
|
||||||
|
console.log('Remove comment emit !!!')
|
||||||
|
// this.$parent.$parent.$emit('deleteComment')
|
||||||
|
this.deleteCallback()
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
}, 1500)
|
}, 1500)
|
||||||
|
|||||||
@ -19,10 +19,18 @@
|
|||||||
class="comments"
|
class="comments"
|
||||||
>
|
>
|
||||||
<comment
|
<comment
|
||||||
v-for="comment in comments"
|
v-for="(comment, index) in comments"
|
||||||
:key="comment.id"
|
:key="comment.id"
|
||||||
:comment="comment"
|
:comment="comment"
|
||||||
|
@deleteComment="deleteComment(index)"
|
||||||
/>
|
/>
|
||||||
|
<!-- <comment
|
||||||
|
is="comment-item"
|
||||||
|
v-for="(comment, index) in comments"
|
||||||
|
:key="comment.id"
|
||||||
|
:comment="comment"
|
||||||
|
v-on:remove="comments.splice(index, 1)"
|
||||||
|
/> -->
|
||||||
</div>
|
</div>
|
||||||
<hc-empty
|
<hc-empty
|
||||||
v-else
|
v-else
|
||||||
@ -61,6 +69,10 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
refetchPostComments(comment) {
|
refetchPostComments(comment) {
|
||||||
this.$apollo.queries.Post.refetch()
|
this.$apollo.queries.Post.refetch()
|
||||||
|
},
|
||||||
|
deleteComment(index) {
|
||||||
|
console.log('Remove comment event !!!')
|
||||||
|
this.comments.splice(index, 1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user