Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix many thinkos in sorting the MemberList #275

Merged
merged 5 commits into from
Apr 18, 2016
Merged

Conversation

ara4n
Copy link
Member

@ara4n ara4n commented Apr 18, 2016

  • Improve ordering of memberlist by absolutizing lastActive correctly
  • Change ordering of memberlist to not try to compare lastActive of 'currentlyActive' users, as lastActive may will be a complete lie as it only gets updated when currentlyActive transitions to false (i think?)
  • Remove order by online/idle/offline in favour of "currently active, ordered by power and then alphabetic name, followed by last active, followed by offline"
  • Fix PresenceLabel to actually calculate itself relative to Date.now()
  • Add commented-out code to track last-spoken-within-a-room ordering.
  • Fix kludges due to SYJS-28 (depends on JS PR landing)

Depends on matrix-org/matrix-js-sdk#128

ara4n added 2 commits April 18, 2016 01:34
Change ordering of memberlist to not try to compare lastActive of 'currentlyActive' users, as lastActive may will be a complete lie as it only gets updated when currentlyActive transitions to false (i think?)
Remove order by online/idle/offline in favour of "currently active, ordered by power and then alphabetic name, followed by last active, followed by offline"
Add commented-out code to track last-spoken-within-a-room ordering.
Fix kludges due to SYJS-28 (depends on JS PR landing)
unavailable: 2,
offline: 1
};
memberSort: function(now) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this actually need now? The relative ordering of users will be the same if you set now to a constant (say, zero), and it would save the extra layer of functions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't. i'm a crank. thanks.

@richvdh
Copy link
Member

richvdh commented Apr 18, 2016

Seems sane, modulo concerns about the sorting function.

@richvdh richvdh assigned ara4n and unassigned richvdh Apr 18, 2016
@ara4n
Copy link
Member Author

ara4n commented Apr 18, 2016

@richvdh PTAL

@ara4n ara4n assigned richvdh and unassigned ara4n Apr 18, 2016
}
},

// returns -1 if a < b.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, my brain is still melting. Please can this be "a comes before b".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, -1 and 1 are not guaranteed. prefer <0 and >0.

@richvdh richvdh assigned ara4n and unassigned richvdh Apr 18, 2016
@ara4n
Copy link
Member Author

ara4n commented Apr 18, 2016

oooooops. final PTAL?

@ara4n ara4n assigned richvdh and unassigned ara4n Apr 18, 2016
@richvdh
Copy link
Member

richvdh commented Apr 18, 2016

lgtm

@richvdh richvdh assigned ara4n and unassigned richvdh Apr 18, 2016
@ara4n ara4n merged commit 8517b65 into develop Apr 18, 2016
richvdh added a commit that referenced this pull request Apr 19, 2016
Remove a spurious } which was introduced in PR #275
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants