Add list of replies under the name/links in conversation statuses, clicking them will highlight the statuses and scroll you to them, expanding a status will scroll you to that status once the conversation has opened.

This commit is contained in:
Shpuld Shpuldson 2017-06-04 23:58:15 +03:00
parent a4493f05d3
commit 4fabeda3ec
4 changed files with 39 additions and 12 deletions

View file

@ -10,7 +10,8 @@ const sortAndFilterConversation = (conversation) => {
const conversation = {
data () {
return {
highlight: null
highlight: null,
statuses: []
}
},
props: [
@ -27,8 +28,8 @@ const conversation = {
const conversationId = this.status.statusnet_conversation_id
const statuses = this.$store.state.statuses.allStatuses
const conversation = filter(statuses, { statusnet_conversation_id: conversationId })
return sortAndFilterConversation(conversation)
this.statuses = sortAndFilterConversation(conversation)
return this.statuses
}
},
components: {
@ -46,6 +47,7 @@ const conversation = {
const conversationId = this.status.statusnet_conversation_id
this.$store.state.api.backendInteractor.fetchConversation({id: conversationId})
.then((statuses) => this.$store.dispatch('addNewStatuses', { statuses }))
.then(() => this.setHighlight(this.statusoid.id))
} else {
const id = this.$route.params.id
this.$store.state.api.backendInteractor.fetchStatus({id})
@ -53,7 +55,21 @@ const conversation = {
.then(() => this.fetchConversation())
}
},
focused: function (id) {
getReplies (id) {
let res = []
id = Number(id)
let i
for (i = 0; i < this.statuses.length; i++) {
if (Number(this.statuses[i].in_reply_to_status_id) === id) {
res.push({
name: `#${i}`,
id: this.statuses[i].id
})
}
}
return res
},
focused (id) {
if (this.statusoid.retweeted_status) {
return (id === this.statusoid.retweeted_status.id)
} else {