|
@@ -32,10 +32,10 @@
|
|
>
|
|
>
|
|
<div class='post__footer_sub_group'>
|
|
<div class='post__footer_sub_group'>
|
|
<heart-button
|
|
<heart-button
|
|
- v-model='likeState'
|
|
|
|
|
|
+ :liked='liked'
|
|
:likes='post.Likes'
|
|
:likes='post.Likes'
|
|
- :likeable='$store.state.username !== post.User.username'
|
|
|
|
- @input='emitLikeUpdate'
|
|
|
|
|
|
+ :likeable='$store.state.username && $store.state.username !== post.User.username'
|
|
|
|
+ @change='emitLikeUpdate'
|
|
></heart-button>
|
|
></heart-button>
|
|
</div>
|
|
</div>
|
|
<div class='post__footer_sub_group' v-if='post.Replies.length'>
|
|
<div class='post__footer_sub_group' v-if='post.Replies.length'>
|
|
@@ -92,8 +92,7 @@
|
|
return {
|
|
return {
|
|
hover: false,
|
|
hover: false,
|
|
showShareModal: false,
|
|
showShareModal: false,
|
|
- postURL: `${location.origin}/thread/${post.Thread.slug}/${post.ThreadId}/${post.postNumber}`,
|
|
|
|
- likeState: false
|
|
|
|
|
|
+ postURL: `${location.origin}/thread/${post.Thread.slug}/${post.ThreadId}/${post.postNumber}`
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -103,6 +102,9 @@
|
|
} else {
|
|
} else {
|
|
return '[deleted]'
|
|
return '[deleted]'
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ liked () {
|
|
|
|
+ return this.post.Likes.some(u => u.username === this.$store.state.username)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -115,8 +117,8 @@
|
|
goToThread () {
|
|
goToThread () {
|
|
this.$router.push(`/thread/${this.post.Thread.slug}/${this.post.Thread.id}`)
|
|
this.$router.push(`/thread/${this.post.Thread.slug}/${this.post.Thread.id}`)
|
|
},
|
|
},
|
|
- emitLikeUpdate () {
|
|
|
|
- this.$emit('like', this.post.id, this.likeState)
|
|
|
|
|
|
+ emitLikeUpdate (state) {
|
|
|
|
+ this.$emit('like', this.post.id, state)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|