diff options
| author | Henry Jameson <me@hjkos.com> | 2019-06-16 20:24:03 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-06-16 20:24:03 +0300 |
| commit | b00da1778830853e0bed4cb1d0fa93ca09a82167 (patch) | |
| tree | 8072f743384b45dc2b4a62e619bb0b1db3e3ebf9 /src/components/conversation/conversation.js | |
| parent | 6c7cf7d9b5f2faec03fe75881b5ec81e0ac851fd (diff) | |
| parent | 1db3c785d805bfe1e7bb09f2d85875448cb03f9a (diff) | |
Merge remote-tracking branch 'upstream/develop' into docs
* upstream/develop: (374 commits)
fix typo
rename mutations according to actual property names
fix
fix
fix logged out post-update
fix user banner
fix
AMERICA
comments
No longer sending extra data, renamed some properties
Revert "add TOTP/Recovery Form for mobile version"
Apply suggestion to src/services/entity_normalizer/entity_normalizer.service.js
i18n/Update Japanese translation
render modal at the root level using portal
install portal vue
Small improve of the who to follow panel layout
Fix/Small fix in the who to follow page
remove console spam
i18n
wire up user.description with masto api data
...
Diffstat (limited to 'src/components/conversation/conversation.js')
| -rw-r--r-- | src/components/conversation/conversation.js | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 69058bf6..b3074590 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -1,5 +1,4 @@ -import { reduce, filter, findIndex } from 'lodash' -import { set } from 'vue' +import { reduce, filter, findIndex, clone } from 'lodash' import Status from '../status/status.vue' const sortById = (a, b) => { @@ -36,14 +35,14 @@ const conversation = { data () { return { highlight: null, - expanded: false, - converationStatusIds: [] + expanded: false } }, props: [ 'statusoid', 'collapsable', - 'isPage' + 'isPage', + 'showPinned' ], created () { if (this.isPage) { @@ -54,15 +53,6 @@ const conversation = { status () { return this.statusoid }, - idsToShow () { - if (this.converationStatusIds.length > 0) { - return this.converationStatusIds - } else if (this.statusId) { - return [this.statusId] - } else { - return [] - } - }, statusId () { if (this.statusoid.retweeted_status) { return this.statusoid.retweeted_status.id @@ -70,6 +60,13 @@ const conversation = { return this.statusoid.id } }, + conversationId () { + if (this.statusoid.retweeted_status) { + return this.statusoid.retweeted_status.statusnet_conversation_id + } else { + return this.statusoid.statusnet_conversation_id + } + }, conversation () { if (!this.status) { return [] @@ -79,12 +76,7 @@ const conversation = { return [this.status] } - const statusesObject = this.$store.state.statuses.allStatusesObject - const conversation = this.idsToShow.reduce((acc, id) => { - acc.push(statusesObject[id]) - return acc - }, []) - + const conversation = clone(this.$store.state.statuses.conversationsObject[this.conversationId]) const statusIndex = findIndex(conversation, { id: this.statusId }) if (statusIndex !== -1) { conversation[statusIndex] = this.status @@ -131,10 +123,6 @@ const conversation = { .then(({ancestors, descendants}) => { this.$store.dispatch('addNewStatuses', { statuses: ancestors }) this.$store.dispatch('addNewStatuses', { statuses: descendants }) - set(this, 'converationStatusIds', [].concat( - ancestors.map(_ => _.id).filter(_ => _ !== this.statusId), - this.statusId, - descendants.map(_ => _.id).filter(_ => _ !== this.statusId))) }) .then(() => this.setHighlight(this.statusId)) } else { @@ -152,6 +140,7 @@ const conversation = { }, setHighlight (id) { this.highlight = id + this.$store.dispatch('fetchFavsAndRepeats', id) }, getHighlight () { return this.isExpanded ? this.highlight : null |
