aboutsummaryrefslogtreecommitdiff
path: root/src/components/conversation/conversation.js
diff options
context:
space:
mode:
authorShpuld Shpuldson <shpuld@gmail.com>2017-06-04 23:58:15 +0300
committerShpuld Shpuldson <shpuld@gmail.com>2017-06-04 23:58:15 +0300
commit4fabeda3ecbd0f194f3951a2394849de504b1a89 (patch)
treecb6a8d850db1df69942fde6823d75171976f3c45 /src/components/conversation/conversation.js
parenta4493f05d319e31d677dcf9cf0835d945e37e998 (diff)
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.
Diffstat (limited to 'src/components/conversation/conversation.js')
-rw-r--r--src/components/conversation/conversation.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js
index e89fa84f..b4bd6296 100644
--- a/src/components/conversation/conversation.js
+++ b/src/components/conversation/conversation.js
@@ -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 {