mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 08:12:40 +01:00
fef3c778fd
Summary: Ref T7707. Ref T8183. - Currently, user status is derived by looking at events they //created//. Instead, look at non-cancelled invites they are attending. - Prepare for on-user caching. - Mostly remove "Sporradic" as a status, although I left room for adding more information later. Test Plan: - Called user.query. - Viewed profile. - Viewed hovercard. - Used mentions. - Saw status immediately update when attending/leaving/cancelling a current event. - Created an event ending at 6 PM and an event from 6:10PM - 7PM, saw "Away until 7PM". Reviewers: chad, btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8183, T7707 Differential Revision: https://secure.phabricator.com/D12833
35 lines
736 B
PHP
35 lines
736 B
PHP
<?php
|
|
|
|
final class PhabricatorUserStatusField
|
|
extends PhabricatorUserCustomField {
|
|
|
|
private $value;
|
|
|
|
public function getFieldKey() {
|
|
return 'user:status';
|
|
}
|
|
|
|
public function getFieldName() {
|
|
return pht('Status');
|
|
}
|
|
|
|
public function getFieldDescription() {
|
|
return pht('Shows when a user is away or busy.');
|
|
}
|
|
|
|
public function shouldAppearInPropertyView() {
|
|
return true;
|
|
}
|
|
|
|
public function isFieldEnabled() {
|
|
return PhabricatorApplication::isClassInstalled(
|
|
'PhabricatorCalendarApplication');
|
|
}
|
|
|
|
public function renderPropertyViewValue(array $handles) {
|
|
$user = $this->getObject();
|
|
$viewer = $this->requireViewer();
|
|
return $user->getAvailabilityDescription($viewer);
|
|
}
|
|
|
|
}
|