#433 - fix retweet abnormal behavior

This commit is contained in:
dave 2019-03-25 16:09:40 -04:00
parent c5ec4829a7
commit 467647d5d7
1 changed files with 13 additions and 5 deletions

View File

@ -18,8 +18,13 @@ const sortById = (a, b) => {
} }
} }
const sortAndFilterConversation = (conversation) => { const sortAndFilterConversation = (conversation, statusoid) => {
conversation = filter(conversation, (status) => status.type !== 'retweet') if (statusoid.type === 'retweet') {
conversation = filter(
conversation,
(status) => (status.type === 'retweet' || status.id !== statusoid.retweeted_status.id)
)
}
return conversation.filter(_ => _).sort(sortById) return conversation.filter(_ => _).sort(sortById)
} }
@ -66,7 +71,7 @@ const conversation = {
return [] return []
} }
if (!this.expanded && !this.isPage) { if (!this.isExpanded) {
return [this.status] return [this.status]
} }
@ -81,7 +86,7 @@ const conversation = {
conversation[statusIndex] = this.status conversation[statusIndex] = this.status
} }
return sortAndFilterConversation(conversation) return sortAndFilterConversation(conversation, this.status)
}, },
replies () { replies () {
let i = 1 let i = 1
@ -139,7 +144,7 @@ const conversation = {
return this.replies[id] || [] return this.replies[id] || []
}, },
focused (id) { focused (id) {
return (this.expanded || this.isPage) && id === this.statusId return (this.isExpanded) && id === this.status.id
}, },
setHighlight (id) { setHighlight (id) {
this.highlight = id this.highlight = id
@ -149,6 +154,9 @@ const conversation = {
}, },
toggleExpanded () { toggleExpanded () {
this.expanded = !this.expanded this.expanded = !this.expanded
if (!this.expanded) {
this.setHighlight(null)
}
} }
} }
} }