Improve like and repost

This commit is contained in:
Peter Stuifzand 2018-08-29 19:25:46 +02:00
parent fc7fddc574
commit 79e606a482
3 changed files with 31 additions and 8 deletions

View File

@ -5,10 +5,11 @@ Some features that need to be implemented
- Like
- Reply
- Repost
- Bookmark?
- Infinite scrolling
- Scrolling backward and forward
- Preview
- Follow, unfollow feeds
- Follow, Unfollow feeds
- Channels create, update, delete
- References to other posts: "refs"
- Channel ordering
@ -17,3 +18,10 @@ Some features that need to be implemented
- Websockets? Show new channels and new items in channels directly, needs
micropub server support
- Improve handling of entries with missing values (like missing author)
## Ideas
### Integrated post interface at the top of the timeline

View File

@ -37,7 +37,7 @@
<a class="card-footer-item" @click="debug">Debug</a>
<a class="card-footer-item" @click="like">Like</a>
<a class="card-footer-item" @click="repost">Repost</a>
<a class="card-footer-item" @click.prevent="reply">Reply</a>
<a class="card-footer-item" @click="reply">Reply</a>
</footer>
</div>
</template>
@ -52,10 +52,20 @@
this.$emit('debug', this.item)
},
like() {
this.$store.dispatch('micropubLike', this.item)
this.$store.dispatch('micropubPost', {
'type': ['h-entry'],
'properties': {
'like-of': [this.item.url]
},
})
},
repost() {
this.$emit('repost', this.item)
this.$store.dispatch('micropubPost', {
'type': ['h-entry'],
'properties': {
'repost-of': [this.item.url]
},
})
}
},

View File

@ -107,14 +107,19 @@ export default new Vuex.Store({
}
})
},
micropubLike(_, item) {
// eslint-disable-next-line
micropubPost(_, mf2post) {
let micropub = new Micropub({
token: this.state.access_token,
micropubEndpoint: this.state.micropubEndpoint
})
micropub.postMicropub({
'like-of': [item.url]
return micropub.create(mf2post)
},
micropubLikeOf(_, url) {
this.dispatch({
'type': ['h-entry'],
'properties': {
'like-of': [url]
}
})
}
}