sort suggestions by last_status_at
This commit is contained in:
parent
5ab0007a44
commit
9cceaa748a
2 changed files with 3 additions and 1 deletions
|
|
@ -131,10 +131,11 @@ export const suggestUsers = ({ dispatch, state }) => {
|
|||
const diff = (bScore - aScore) * 10
|
||||
|
||||
// Then sort alphabetically
|
||||
const activity = a.last_status_at < b.last_status_at ? 100 : -100
|
||||
const nameAlphabetically = a.name > b.name ? 1 : -1
|
||||
const screenNameAlphabetically = a.screen_name > b.screen_name ? 1 : -1
|
||||
|
||||
return diff + nameAlphabetically + screenNameAlphabetically
|
||||
return diff + nameAlphabetically + screenNameAlphabetically + activity
|
||||
})
|
||||
.map((user) => ({
|
||||
user,
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ export const parseUser = (data) => {
|
|||
|
||||
output.created_at = new Date(data.created_at)
|
||||
output.locked = data.locked
|
||||
output.last_status_at = new Date(data.last_status_at)
|
||||
output.followers_count = data.followers_count
|
||||
output.statuses_count = data.statuses_count
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue