Merge branch 'hotfix-broken-convos' into 'develop'

Hotfix broken convos

See merge request pleroma/pleroma-fe!476
This commit is contained in:
HJ 2019-01-25 13:29:24 +00:00
commit a733a33d36

View file

@ -1,9 +1,9 @@
import { reduce, filter, sortBy } from 'lodash' import { reduce, filter } from 'lodash'
import Status from '../status/status.vue' import Status from '../status/status.vue'
const sortById = (a, b) => { const sortById = (a, b) => {
const seqA = Number(a.action.id) const seqA = Number(a.id)
const seqB = Number(b.action.id) const seqB = Number(b.id)
const isSeqA = !Number.isNaN(seqA) const isSeqA = !Number.isNaN(seqA)
const isSeqB = !Number.isNaN(seqB) const isSeqB = !Number.isNaN(seqB)
if (isSeqA && isSeqB) { if (isSeqA && isSeqB) {
@ -13,13 +13,13 @@ const sortById = (a, b) => {
} else if (!isSeqA && isSeqB) { } else if (!isSeqA && isSeqB) {
return -1 return -1
} else { } else {
return a.action.id > b.action.id ? -1 : 1 return a.id > b.id ? -1 : 1
} }
} }
const sortAndFilterConversation = (conversation) => { const sortAndFilterConversation = (conversation) => {
conversation = filter(conversation, (status) => status.type !== 'retweet') conversation = filter(conversation, (status) => status.type !== 'retweet')
return sortBy(conversation, sortById) return conversation.filter(_ => _).sort(sortById)
} }
const conversation = { const conversation = {