1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Conpherence - sort participant list in a case insensitive way

Summary: Fixes T7857. Some sorting gymnastics - make a nice list for natcasesort and then array_select_key to sort - but nothing too crazy.

Test Plan: made a room with user "btrahan" and other users "BTRAHA", "BTRAHANCAPS", and "xerxes". chat room correctly ordered "btrahan" (since logged in user always at top), "BTRAHA", "BTRAHANCAPS", "xerxes". Viewed room as "xerxes" and saw ordering "xerxes", "BTRAHA", "btrahan", "BTRAHANCAPS".

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7857

Differential Revision: https://secure.phabricator.com/D12507
This commit is contained in:
Bob Trahan 2015-04-22 12:19:24 -07:00
parent 306ab29259
commit 2e8649c292

View file

@ -9,12 +9,17 @@ final class ConpherencePeopleWidgetView extends ConpherenceWidgetView {
$conpherence = $this->getConpherence(); $conpherence = $this->getConpherence();
$participants = $conpherence->getParticipants(); $participants = $conpherence->getParticipants();
$handles = $conpherence->getHandles(); $handles = $conpherence->getHandles();
$handles = msort($handles, 'getName');
$head_handles = array_select_keys($handles, array($user->getPHID())); $head_handles = array_select_keys($handles, array($user->getPHID()));
$handle_list = mpull($handles, 'getName');
natcasesort($handle_list);
$handles = mpull($handles, null, 'getName');
$handles = array_select_keys($handles, $handle_list);
$head_handles = mpull($head_handles, null, 'getName');
$handles = $head_handles + $handles; $handles = $head_handles + $handles;
$body = array(); $body = array();
foreach ($handles as $user_phid => $handle) { foreach ($handles as $handle) {
$user_phid = $handle->getPHID();
$remove_html = ''; $remove_html = '';
if ($user_phid == $user->getPHID()) { if ($user_phid == $user->getPHID()) {
$icon = id(new PHUIIconView()) $icon = id(new PHUIIconView())
@ -25,7 +30,7 @@ final class ConpherencePeopleWidgetView extends ConpherenceWidgetView {
'class' => 'remove', 'class' => 'remove',
'sigil' => 'remove-person', 'sigil' => 'remove-person',
'meta' => array( 'meta' => array(
'remove_person' => $handle->getPHID(), 'remove_person' => $user_phid,
'action' => 'remove_person', 'action' => 'remove_person',
), ),
), ),