#433 - sort conversation for retweets and clean up
This commit is contained in:
parent
0e2931e7de
commit
43e97e590c
2 changed files with 7 additions and 15 deletions
|
@ -3,19 +3,9 @@ import { set } from 'vue'
|
||||||
import Status from '../status/status.vue'
|
import Status from '../status/status.vue'
|
||||||
|
|
||||||
const sortById = (a, b) => {
|
const sortById = (a, b) => {
|
||||||
const seqA = Number(a.id)
|
const idA = a.type === 'retweet' ? a.retweeted_status.id : a.id
|
||||||
const seqB = Number(b.id)
|
const idB = b.type === 'retweet' ? b.retweeted_status.id : b.id
|
||||||
const isSeqA = !Number.isNaN(seqA)
|
return idA < idB ? -1 : 1
|
||||||
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 a.id < b.id ? -1 : 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortAndFilterConversation = (conversation, statusoid) => {
|
const sortAndFilterConversation = (conversation, statusoid) => {
|
||||||
|
@ -24,6 +14,8 @@ const sortAndFilterConversation = (conversation, statusoid) => {
|
||||||
conversation,
|
conversation,
|
||||||
(status) => (status.type === 'retweet' || status.id !== statusoid.retweeted_status.id)
|
(status) => (status.type === 'retweet' || status.id !== statusoid.retweeted_status.id)
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
conversation = filter(conversation, (status) => status.type !== 'retweet')
|
||||||
}
|
}
|
||||||
return conversation.filter(_ => _).sort(sortById)
|
return conversation.filter(_ => _).sort(sortById)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div v-if="retweet && !noHeading" :class="[repeaterClass, { highlighted: repeaterStyle }]" :style="[repeaterStyle]" class="media container retweet-info">
|
<div v-if="retweet && !noHeading && !inConversation" :class="[repeaterClass, { highlighted: repeaterStyle }]" :style="[repeaterStyle]" class="media container retweet-info">
|
||||||
<UserAvatar class="media-left" v-if="retweet" :betterShadow="betterShadow" :src="statusoid.user.profile_image_url_original"/>
|
<UserAvatar class="media-left" v-if="retweet" :betterShadow="betterShadow" :src="statusoid.user.profile_image_url_original"/>
|
||||||
<div class="media-body faint">
|
<div class="media-body faint">
|
||||||
<span class="user-name">
|
<span class="user-name">
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div :class="[userClass, { highlighted: userStyle, 'is-retweet': retweet }]" :style="[ userStyle ]" class="media status">
|
<div :class="[userClass, { highlighted: userStyle, 'is-retweet': retweet && !inConversation }]" :style="[ userStyle ]" class="media status">
|
||||||
<div v-if="!noHeading" class="media-left">
|
<div v-if="!noHeading" class="media-left">
|
||||||
<router-link :to="userProfileLink" @click.stop.prevent.capture.native="toggleUserExpanded">
|
<router-link :to="userProfileLink" @click.stop.prevent.capture.native="toggleUserExpanded">
|
||||||
<UserAvatar :compact="compact" :betterShadow="betterShadow" :src="status.user.profile_image_url_original"/>
|
<UserAvatar :compact="compact" :betterShadow="betterShadow" :src="status.user.profile_image_url_original"/>
|
||||||
|
|
Loading…
Reference in a new issue