forked from AkkomaGang/akkoma-fe
#433 - update sort by for conversation
This commit is contained in:
parent
e24145e233
commit
a39fc49e84
1 changed files with 13 additions and 1 deletions
|
@ -5,7 +5,19 @@ import Status from '../status/status.vue'
|
|||
const sortById = (a, b) => {
|
||||
const idA = a.type === 'retweet' ? a.retweeted_status.id : a.id
|
||||
const idB = b.type === 'retweet' ? b.retweeted_status.id : b.id
|
||||
return idA < idB ? -1 : 1
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
const sortAndFilterConversation = (conversation, statusoid) => {
|
||||
|
|
Loading…
Reference in a new issue