1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00

Highlight away and sporadic users in revision list

Summary:
This is not so general as `getRequiredHandlePHIDs()`.
It allows bulk loading of user statuses only in revision list.

It also loads data in `render()`. I'm not sure if it's OK.

Maybe we can use the colorful point here.
Or maybe some unicode symbol?

Test Plan: {F11451, size=full}

Reviewers: btrahan, epriestley

Reviewed By: btrahan

CC: aran, Koolvin

Differential Revision: https://secure.phabricator.com/D2484
This commit is contained in:
vrana 2012-05-16 18:42:06 -07:00
parent d9b4fcb336
commit 9f35a3ba45
10 changed files with 63 additions and 37 deletions

View file

@ -2209,7 +2209,7 @@ celerity_register_resource_map(array(
),
'phabricator-standard-page-view' =>
array(
'uri' => '/res/cfa91002/rsrc/css/application/base/standard-page-view.css',
'uri' => '/res/30fbf899/rsrc/css/application/base/standard-page-view.css',
'type' => 'css',
'requires' =>
array(
@ -2464,7 +2464,7 @@ celerity_register_resource_map(array(
), array(
'packages' =>
array(
'2b054c5c' =>
'5b0e4abf' =>
array(
'name' => 'core.pkg.css',
'symbols' =>
@ -2493,7 +2493,7 @@ celerity_register_resource_map(array(
21 => 'phabricator-flag-css',
22 => 'aphront-error-view-css',
),
'uri' => '/res/pkg/2b054c5c/core.pkg.css',
'uri' => '/res/pkg/5b0e4abf/core.pkg.css',
'type' => 'css',
),
'0c96375e' =>
@ -2660,20 +2660,20 @@ celerity_register_resource_map(array(
'reverse' =>
array(
'aphront-attached-file-view-css' => '7839ae2d',
'aphront-crumbs-view-css' => '2b054c5c',
'aphront-dialog-view-css' => '2b054c5c',
'aphront-error-view-css' => '2b054c5c',
'aphront-form-view-css' => '2b054c5c',
'aphront-crumbs-view-css' => '5b0e4abf',
'aphront-dialog-view-css' => '5b0e4abf',
'aphront-error-view-css' => '5b0e4abf',
'aphront-form-view-css' => '5b0e4abf',
'aphront-headsup-action-list-view-css' => 'd9299c35',
'aphront-headsup-view-css' => '2b054c5c',
'aphront-list-filter-view-css' => '2b054c5c',
'aphront-pager-view-css' => '2b054c5c',
'aphront-panel-view-css' => '2b054c5c',
'aphront-side-nav-view-css' => '2b054c5c',
'aphront-table-view-css' => '2b054c5c',
'aphront-tokenizer-control-css' => '2b054c5c',
'aphront-tooltip-css' => '2b054c5c',
'aphront-typeahead-control-css' => '2b054c5c',
'aphront-headsup-view-css' => '5b0e4abf',
'aphront-list-filter-view-css' => '5b0e4abf',
'aphront-pager-view-css' => '5b0e4abf',
'aphront-panel-view-css' => '5b0e4abf',
'aphront-side-nav-view-css' => '5b0e4abf',
'aphront-table-view-css' => '5b0e4abf',
'aphront-tokenizer-control-css' => '5b0e4abf',
'aphront-tooltip-css' => '5b0e4abf',
'aphront-typeahead-control-css' => '5b0e4abf',
'differential-changeset-view-css' => 'd9299c35',
'differential-core-view-css' => 'd9299c35',
'differential-inline-comment-editor' => '5ef7da0b',
@ -2739,15 +2739,15 @@ celerity_register_resource_map(array(
'javelin-workflow' => '0c96375e',
'maniphest-task-summary-css' => '7839ae2d',
'maniphest-transaction-detail-css' => '7839ae2d',
'phabricator-app-buttons-css' => '2b054c5c',
'phabricator-app-buttons-css' => '5b0e4abf',
'phabricator-content-source-view-css' => 'd9299c35',
'phabricator-core-buttons-css' => '2b054c5c',
'phabricator-core-css' => '2b054c5c',
'phabricator-directory-css' => '2b054c5c',
'phabricator-core-buttons-css' => '5b0e4abf',
'phabricator-core-css' => '5b0e4abf',
'phabricator-directory-css' => '5b0e4abf',
'phabricator-drag-and-drop-file-upload' => '5ef7da0b',
'phabricator-dropdown-menu' => '0c96375e',
'phabricator-flag-css' => '2b054c5c',
'phabricator-jump-nav' => '2b054c5c',
'phabricator-flag-css' => '5b0e4abf',
'phabricator-jump-nav' => '5b0e4abf',
'phabricator-keyboard-shortcut' => '0c96375e',
'phabricator-keyboard-shortcut-manager' => '0c96375e',
'phabricator-menu-item' => '0c96375e',
@ -2755,11 +2755,11 @@ celerity_register_resource_map(array(
'phabricator-paste-file-upload' => '0c96375e',
'phabricator-prefab' => '0c96375e',
'phabricator-project-tag-css' => '7839ae2d',
'phabricator-remarkup-css' => '2b054c5c',
'phabricator-remarkup-css' => '5b0e4abf',
'phabricator-shaped-request' => '5ef7da0b',
'phabricator-standard-page-view' => '2b054c5c',
'phabricator-standard-page-view' => '5b0e4abf',
'phabricator-tooltip' => '0c96375e',
'phabricator-transaction-view-css' => '2b054c5c',
'syntax-highlighting-css' => '2b054c5c',
'phabricator-transaction-view-css' => '5b0e4abf',
'syntax-highlighting-css' => '5b0e4abf',
),
));

View file

@ -46,8 +46,7 @@ final class ConduitAPI_user_getcurrentstatus_Method
}
protected function execute(ConduitAPIRequest $request) {
$statuses = id(new PhabricatorUserStatus())->loadAllWhere(
'userPHID IN (%Ls) AND UNIX_TIMESTAMP() BETWEEN dateFrom AND dateTo',
$statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses(
$request->getValue('userPHIDs'));
$return = array();

View file

@ -277,10 +277,8 @@ abstract class DifferentialFieldSpecification {
return '<em>None</em>';
}
$statuses = id(new PhabricatorUserStatus())->loadAllWhere(
'userPHID IN (%Ls) AND UNIX_TIMESTAMP() BETWEEN dateFrom AND dateTo',
$statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses(
$user_phids);
$statuses = mpull($statuses, null, 'getUserPHID');
$links = array();
foreach ($user_phids as $user_phid) {

View file

@ -127,11 +127,10 @@ final class PhabricatorPeopleProfileController
if ($user->getIsDisabled()) {
$header->setStatus('Disabled');
} else {
$status = id(new PhabricatorUserStatus())->loadOneWhere(
'userPHID = %s AND UNIX_TIMESTAMP() BETWEEN dateFrom AND dateTo',
$user->getPHID());
if ($status) {
$header->setStatus($status->getStatusDescription());
$statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses(
array($user->getPHID()));
if ($statuses) {
$header->setStatus(reset($statuses)->getStatusDescription());
}
}

View file

@ -49,4 +49,11 @@ final class PhabricatorUserStatus extends PhabricatorUserDAO {
return $this->setStatus($statuses[$status]);
}
public function loadCurrentStatuses($user_phids) {
$statuses = $this->loadAllWhere(
'userPHID IN (%Ls) AND UNIX_TIMESTAMP() BETWEEN dateFrom AND dateTo',
$user_phids);
return mpull($statuses, null, 'getUserPHID');
}
}

View file

@ -9,5 +9,7 @@
phutil_require_module('phabricator', 'applications/people/storage/base');
phutil_require_module('phabricator', 'view/utils');
phutil_require_module('phutil', 'utils');
phutil_require_source('PhabricatorUserStatus.php');

View file

@ -27,7 +27,7 @@ final class PhabricatorObjectHandle {
private $imageURI;
private $timestamp;
private $alternateID;
private $status = 'open';
private $status = PhabricatorObjectHandleStatus::STATUS_OPEN;
private $complete;
private $disabled;
@ -197,13 +197,16 @@ final class PhabricatorObjectHandle {
public function renderLink() {
$name = $this->getLinkName();
$class = null;
$title = null;
if ($this->status != PhabricatorObjectHandleStatus::STATUS_OPEN) {
$class .= ' handle-status-'.$this->status;
$title = $this->status;
}
if ($this->disabled) {
$class .= ' handle-disabled';
$title = 'disabled'; // Overwrite status.
}
return phutil_render_tag(
@ -211,6 +214,7 @@ final class PhabricatorObjectHandle {
array(
'href' => $this->getURI(),
'class' => $class,
'title' => $title,
),
phutil_escape_html($name));
}

View file

@ -156,6 +156,9 @@ final class PhabricatorObjectHandleData {
$phids);
$emails = mpull($emails, 'getAddress', 'getUserPHID');
$statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses(
$phids);
foreach ($phids as $phid) {
$handle = new PhabricatorObjectHandle();
$handle->setPHID($phid);
@ -171,6 +174,9 @@ final class PhabricatorObjectHandleData {
$user->getUsername().' ('.$user->getRealName().')');
$handle->setAlternateID($user->getID());
$handle->setComplete(true);
if (isset($statuses[$phid])) {
$handle->setStatus($statuses[$phid]->getTextStatus());
}
$handle->setDisabled($user->getIsDisabled() ||
$user->getIsSystemAgent());

View file

@ -13,6 +13,7 @@ phutil_require_module('phabricator', 'applications/maniphest/constants/owner');
phutil_require_module('phabricator', 'applications/maniphest/constants/status');
phutil_require_module('phabricator', 'applications/people/storage/email');
phutil_require_module('phabricator', 'applications/people/storage/user');
phutil_require_module('phabricator', 'applications/people/storage/userstatus');
phutil_require_module('phabricator', 'applications/phid/constants');
phutil_require_module('phabricator', 'applications/phid/handle');
phutil_require_module('phabricator', 'applications/phid/handle/const/status');

View file

@ -187,6 +187,16 @@ td.phabricator-login-details {
text-decoration: line-through;
}
.aphront-table-view a.handle-status-away {
border-left: 2px solid #aa0000;
padding-left: .25em;
}
.aphront-table-view a.handle-status-sporadic {
border-left: 2px solid #ffdd33;
padding-left: .25em;
}
a.handle-disabled {
background: #999999;
color: #cccccc;