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 - Like
- Reply - Reply
- Repost - Repost
- Bookmark?
- Infinite scrolling - Infinite scrolling
- Scrolling backward and forward - Scrolling backward and forward
- Preview - Preview
- Follow, unfollow feeds - Follow, Unfollow feeds
- Channels create, update, delete - Channels create, update, delete
- References to other posts: "refs" - References to other posts: "refs"
- Channel ordering - Channel ordering
@ -17,3 +18,10 @@ Some features that need to be implemented
- Websockets? Show new channels and new items in channels directly, needs - Websockets? Show new channels and new items in channels directly, needs
micropub server support micropub server support
- Improve handling of entries with missing values (like missing author) - 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="debug">Debug</a>
<a class="card-footer-item" @click="like">Like</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="repost">Repost</a>
<a class="card-footer-item" @click.prevent="reply">Reply</a> <a class="card-footer-item" @click="reply">Reply</a>
</footer> </footer>
</div> </div>
</template> </template>
@ -52,10 +52,20 @@
this.$emit('debug', this.item) this.$emit('debug', this.item)
}, },
like() { like() {
this.$store.dispatch('micropubLike', this.item) this.$store.dispatch('micropubPost', {
'type': ['h-entry'],
'properties': {
'like-of': [this.item.url]
},
})
}, },
repost() { 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) { micropubPost(_, mf2post) {
// eslint-disable-next-line
let micropub = new Micropub({ let micropub = new Micropub({
token: this.state.access_token, token: this.state.access_token,
micropubEndpoint: this.state.micropubEndpoint micropubEndpoint: this.state.micropubEndpoint
}) })
micropub.postMicropub({ return micropub.create(mf2post)
'like-of': [item.url] },
micropubLikeOf(_, url) {
this.dispatch({
'type': ['h-entry'],
'properties': {
'like-of': [url]
}
}) })
} }
} }