Page MenuHomePhabricator

D20864.diff
No OneTemporary

D20864.diff

diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php
--- a/src/applications/project/controller/PhabricatorProjectProfileController.php
+++ b/src/applications/project/controller/PhabricatorProjectProfileController.php
@@ -63,14 +63,14 @@
$member_list = id(new PhabricatorProjectMemberListView())
->setUser($viewer)
->setProject($project)
- ->setLimit(5)
+ ->setLimit(10)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setUserPHIDs($project->getMemberPHIDs());
$watcher_list = id(new PhabricatorProjectWatcherListView())
->setUser($viewer)
->setProject($project)
- ->setLimit(5)
+ ->setLimit(10)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setUserPHIDs($project->getWatcherPHIDs());
diff --git a/src/applications/project/view/PhabricatorProjectUserListView.php b/src/applications/project/view/PhabricatorProjectUserListView.php
--- a/src/applications/project/view/PhabricatorProjectUserListView.php
+++ b/src/applications/project/view/PhabricatorProjectUserListView.php
@@ -1,6 +1,7 @@
<?php
-abstract class PhabricatorProjectUserListView extends AphrontView {
+abstract class PhabricatorProjectUserListView
+ extends AphrontView {
private $project;
private $userPHIDs;
@@ -57,49 +58,74 @@
$user_phids = $this->getUserPHIDs();
$can_edit = $this->canEditList();
+ $supports_edit = $project->supportsEditMembers();
$no_data = $this->getNoDataString();
$list = id(new PHUIObjectItemListView())
->setNoDataString($no_data);
$limit = $this->getLimit();
-
- // If we're showing everything, show oldest to newest. If we're showing
- // only a slice, show newest to oldest.
- if (!$limit) {
- $user_phids = array_reverse($user_phids);
- }
+ $is_panel = (bool)$limit;
$handles = $viewer->loadHandles($user_phids);
- // Always put the viewer first if they are on the list.
- $user_phids = array_fuse($user_phids);
- $user_phids =
- array_select_keys($user_phids, array($viewer->getPHID())) +
- $user_phids;
+ // Reorder users in display order. We're going to put the viewer first
+ // if they're a member, then enabled users, then disabled/invalid users.
- if ($limit) {
- $render_phids = array_slice($user_phids, 0, $limit);
- } else {
- $render_phids = $user_phids;
+ $phid_map = array();
+ foreach ($user_phids as $user_phid) {
+ $handle = $handles[$user_phid];
+
+ $is_viewer = ($user_phid === $viewer->getPHID());
+ $is_enabled = ($handle->isComplete() && !$handle->isDisabled());
+
+ // If we're showing the main member list, show oldest to newest. If we're
+ // showing only a slice in a panel, show newest to oldest.
+ if ($limit) {
+ $order_scalar = 1;
+ } else {
+ $order_scalar = -1;
+ }
+
+ $phid_map[$user_phid] = id(new PhutilSortVector())
+ ->addInt($is_viewer ? 0 : 1)
+ ->addInt($is_enabled ? 0 : 1)
+ ->addInt($order_scalar * count($phid_map));
}
+ $phid_map = msortv($phid_map, 'getSelf');
- foreach ($render_phids as $user_phid) {
- $handle = $handles[$user_phid];
+ $handles = iterator_to_array($handles);
+ $handles = array_select_keys($handles, array_keys($phid_map));
+ if ($limit) {
+ $handles = array_slice($handles, 0, $limit);
+ }
+
+ foreach ($handles as $user_phid => $handle) {
$item = id(new PHUIObjectItemView())
->setHeader($handle->getFullName())
->setHref($handle->getURI())
->setImageURI($handle->getImageURI());
- $icon = id(new PHUIIconView())
- ->setIcon($handle->getIcon());
+ if ($handle->isDisabled()) {
+ if ($is_panel) {
+ // Don't show disabled users in the panel view at all.
+ continue;
+ }
+
+ $item
+ ->setDisabled(true)
+ ->addAttribute(pht('Disabled'));
+ } else {
+ $icon = id(new PHUIIconView())
+ ->setIcon($handle->getIcon());
- $subtitle = $handle->getSubtitle();
+ $subtitle = $handle->getSubtitle();
- $item->addAttribute(array($icon, ' ', $subtitle));
+ $item->addAttribute(array($icon, ' ', $subtitle));
+ }
- if ($can_edit && !$limit) {
+ if ($supports_edit && !$is_panel) {
$remove_uri = $this->getRemoveURI($user_phid);
$item->addAction(
@@ -107,6 +133,7 @@
->setIcon('fa-times')
->setName(pht('Remove'))
->setHref($remove_uri)
+ ->setDisabled(!$can_edit)
->setWorkflow(true));
}
@@ -128,14 +155,9 @@
->setHeader($header_text);
if ($limit) {
- $header->addActionLink(
- id(new PHUIButtonView())
- ->setTag('a')
- ->setIcon(
- id(new PHUIIconView())
- ->setIcon('fa-list-ul'))
- ->setText(pht('View All'))
- ->setHref("/project/members/{$id}/"));
+ $list->newTailButton()
+ ->setText(pht('View All'))
+ ->setHref("/project/members/{$id}/");
}
$box = id(new PHUIObjectBoxView())

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 7:42 PM (16 h, 51 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6923953
Default Alt Text
D20864.diff (5 KB)

Event Timeline