aboutsummaryrefslogtreecommitdiff
path: root/src/components/conversation
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/conversation')
-rw-r--r--src/components/conversation/conversation.js17
-rw-r--r--src/components/conversation/conversation.vue27
2 files changed, 26 insertions, 18 deletions
diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js
index b3074590..49fa8612 100644
--- a/src/components/conversation/conversation.js
+++ b/src/components/conversation/conversation.js
@@ -42,7 +42,7 @@ const conversation = {
'statusoid',
'collapsable',
'isPage',
- 'showPinned'
+ 'pinnedStatusIdsObject'
],
created () {
if (this.isPage) {
@@ -86,7 +86,8 @@ const conversation = {
},
replies () {
let i = 1
- return reduce(this.conversation, (result, {id, in_reply_to_status_id}) => {
+ // eslint-disable-next-line camelcase
+ return reduce(this.conversation, (result, { id, in_reply_to_status_id }) => {
/* eslint-disable camelcase */
const irid = in_reply_to_status_id
/* eslint-enable camelcase */
@@ -109,7 +110,7 @@ const conversation = {
Status
},
watch: {
- '$route': 'fetchConversation',
+ status: 'fetchConversation',
expanded (value) {
if (value) {
this.fetchConversation()
@@ -119,15 +120,15 @@ const conversation = {
methods: {
fetchConversation () {
if (this.status) {
- this.$store.state.api.backendInteractor.fetchConversation({id: this.status.id})
- .then(({ancestors, descendants}) => {
+ this.$store.state.api.backendInteractor.fetchConversation({ id: this.status.id })
+ .then(({ ancestors, descendants }) => {
this.$store.dispatch('addNewStatuses', { statuses: ancestors })
this.$store.dispatch('addNewStatuses', { statuses: descendants })
})
.then(() => this.setHighlight(this.statusId))
} else {
const id = this.$route.params.id
- this.$store.state.api.backendInteractor.fetchStatus({id})
+ this.$store.state.api.backendInteractor.fetchStatus({ id })
.then((status) => this.$store.dispatch('addNewStatuses', { statuses: [status] }))
.then(() => this.fetchConversation())
}
@@ -139,6 +140,7 @@ const conversation = {
return (this.isExpanded) && id === this.status.id
},
setHighlight (id) {
+ if (!id) return
this.highlight = id
this.$store.dispatch('fetchFavsAndRepeats', id)
},
@@ -147,9 +149,6 @@ const conversation = {
},
toggleExpanded () {
this.expanded = !this.expanded
- if (!this.expanded) {
- this.setHighlight(null)
- }
}
}
}
diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue
index 0b4998c3..f184c071 100644
--- a/src/components/conversation/conversation.vue
+++ b/src/components/conversation/conversation.vue
@@ -1,25 +1,34 @@
<template>
- <div class="timeline panel-default" :class="[isExpanded ? 'panel' : 'panel-disabled']">
- <div v-if="isExpanded" class="panel-heading conversation-heading">
+ <div
+ class="timeline panel-default"
+ :class="[isExpanded ? 'panel' : 'panel-disabled']"
+ >
+ <div
+ v-if="isExpanded"
+ class="panel-heading conversation-heading"
+ >
<span class="title"> {{ $t('timeline.conversation') }} </span>
<span v-if="collapsable">
- <a href="#" @click.prevent="toggleExpanded">{{ $t('timeline.collapse') }}</a>
+ <a
+ href="#"
+ @click.prevent="toggleExpanded"
+ >{{ $t('timeline.collapse') }}</a>
</span>
</div>
<status
v-for="status in conversation"
- @goto="setHighlight"
- @toggleExpanded="toggleExpanded"
:key="status.id"
- :inlineExpanded="collapsable && isExpanded"
+ :inline-expanded="collapsable && isExpanded"
:statusoid="status"
- :expandable='!isExpanded'
- :showPinned="showPinned"
+ :expandable="!isExpanded"
+ :show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
:focused="focused(status.id)"
- :inConversation="isExpanded"
+ :in-conversation="isExpanded"
:highlight="getHighlight()"
:replies="getReplies(status.id)"
class="status-fadein panel-body"
+ @goto="setHighlight"
+ @toggleExpanded="toggleExpanded"
/>
</div>
</template>