#433 - update sort by for conversation

This commit is contained in:
dave 2019-03-28 10:02:33 -04:00
parent e24145e233
commit a39fc49e84

View file

@ -5,8 +5,20 @@ import Status from '../status/status.vue'
const sortById = (a, b) => { const sortById = (a, b) => {
const idA = a.type === 'retweet' ? a.retweeted_status.id : a.id const idA = a.type === 'retweet' ? a.retweeted_status.id : a.id
const idB = b.type === 'retweet' ? b.retweeted_status.id : b.id const idB = b.type === 'retweet' ? b.retweeted_status.id : b.id
const seqA = Number(idA)
const seqB = Number(idB)
const isSeqA = !Number.isNaN(seqA)
const isSeqB = !Number.isNaN(seqB)
if (isSeqA && isSeqB) {
return seqA < seqB ? -1 : 1
} else if (isSeqA && !isSeqB) {
return -1
} else if (!isSeqA && isSeqB) {
return 1
} else {
return idA < idB ? -1 : 1 return idA < idB ? -1 : 1
} }
}
const sortAndFilterConversation = (conversation, statusoid) => { const sortAndFilterConversation = (conversation, statusoid) => {
if (statusoid.type === 'retweet') { if (statusoid.type === 'retweet') {