Remove "status" field from events
Summary: Ref T8183. See that task for discussion. - For now, events always mark users as "Away". - In the future, we may reintroduce "sporradic" or other more complicated availability states, but they would be properties of the invitee, not of the event itself. - This also removes the long-deprecated `user.addstatus` and `user.removestatus` Conduit calls. Test Plan: - Created, edited, viewed events. - Grepped for removed symbols. - Viewed profile calendar. - Viewed Conpherence calendar. - Load Conduit console. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8183 Differential Revision: https://secure.phabricator.com/D12840
This commit is contained in:
2
resources/sql/autopatches/20150514.calendar.status.sql
Normal file
2
resources/sql/autopatches/20150514.calendar.status.sql
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE {$NAMESPACE}_calendar.calendar_event
|
||||||
|
DROP status;
|
||||||
@@ -3200,13 +3200,11 @@ phutil_register_library_map(array(
|
|||||||
'TokenGiveConduitAPIMethod' => 'applications/tokens/conduit/TokenGiveConduitAPIMethod.php',
|
'TokenGiveConduitAPIMethod' => 'applications/tokens/conduit/TokenGiveConduitAPIMethod.php',
|
||||||
'TokenGivenConduitAPIMethod' => 'applications/tokens/conduit/TokenGivenConduitAPIMethod.php',
|
'TokenGivenConduitAPIMethod' => 'applications/tokens/conduit/TokenGivenConduitAPIMethod.php',
|
||||||
'TokenQueryConduitAPIMethod' => 'applications/tokens/conduit/TokenQueryConduitAPIMethod.php',
|
'TokenQueryConduitAPIMethod' => 'applications/tokens/conduit/TokenQueryConduitAPIMethod.php',
|
||||||
'UserAddStatusConduitAPIMethod' => 'applications/people/conduit/UserAddStatusConduitAPIMethod.php',
|
|
||||||
'UserConduitAPIMethod' => 'applications/people/conduit/UserConduitAPIMethod.php',
|
'UserConduitAPIMethod' => 'applications/people/conduit/UserConduitAPIMethod.php',
|
||||||
'UserDisableConduitAPIMethod' => 'applications/people/conduit/UserDisableConduitAPIMethod.php',
|
'UserDisableConduitAPIMethod' => 'applications/people/conduit/UserDisableConduitAPIMethod.php',
|
||||||
'UserEnableConduitAPIMethod' => 'applications/people/conduit/UserEnableConduitAPIMethod.php',
|
'UserEnableConduitAPIMethod' => 'applications/people/conduit/UserEnableConduitAPIMethod.php',
|
||||||
'UserFindConduitAPIMethod' => 'applications/people/conduit/UserFindConduitAPIMethod.php',
|
'UserFindConduitAPIMethod' => 'applications/people/conduit/UserFindConduitAPIMethod.php',
|
||||||
'UserQueryConduitAPIMethod' => 'applications/people/conduit/UserQueryConduitAPIMethod.php',
|
'UserQueryConduitAPIMethod' => 'applications/people/conduit/UserQueryConduitAPIMethod.php',
|
||||||
'UserRemoveStatusConduitAPIMethod' => 'applications/people/conduit/UserRemoveStatusConduitAPIMethod.php',
|
|
||||||
'UserWhoAmIConduitAPIMethod' => 'applications/people/conduit/UserWhoAmIConduitAPIMethod.php',
|
'UserWhoAmIConduitAPIMethod' => 'applications/people/conduit/UserWhoAmIConduitAPIMethod.php',
|
||||||
),
|
),
|
||||||
'function' => array(
|
'function' => array(
|
||||||
@@ -6781,13 +6779,11 @@ phutil_register_library_map(array(
|
|||||||
'TokenGiveConduitAPIMethod' => 'TokenConduitAPIMethod',
|
'TokenGiveConduitAPIMethod' => 'TokenConduitAPIMethod',
|
||||||
'TokenGivenConduitAPIMethod' => 'TokenConduitAPIMethod',
|
'TokenGivenConduitAPIMethod' => 'TokenConduitAPIMethod',
|
||||||
'TokenQueryConduitAPIMethod' => 'TokenConduitAPIMethod',
|
'TokenQueryConduitAPIMethod' => 'TokenConduitAPIMethod',
|
||||||
'UserAddStatusConduitAPIMethod' => 'UserConduitAPIMethod',
|
|
||||||
'UserConduitAPIMethod' => 'ConduitAPIMethod',
|
'UserConduitAPIMethod' => 'ConduitAPIMethod',
|
||||||
'UserDisableConduitAPIMethod' => 'UserConduitAPIMethod',
|
'UserDisableConduitAPIMethod' => 'UserConduitAPIMethod',
|
||||||
'UserEnableConduitAPIMethod' => 'UserConduitAPIMethod',
|
'UserEnableConduitAPIMethod' => 'UserConduitAPIMethod',
|
||||||
'UserFindConduitAPIMethod' => 'UserConduitAPIMethod',
|
'UserFindConduitAPIMethod' => 'UserConduitAPIMethod',
|
||||||
'UserQueryConduitAPIMethod' => 'UserConduitAPIMethod',
|
'UserQueryConduitAPIMethod' => 'UserConduitAPIMethod',
|
||||||
'UserRemoveStatusConduitAPIMethod' => 'UserConduitAPIMethod',
|
|
||||||
'UserWhoAmIConduitAPIMethod' => 'UserConduitAPIMethod',
|
'UserWhoAmIConduitAPIMethod' => 'UserConduitAPIMethod',
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ final class PhabricatorCalendarEventEditController
|
|||||||
|
|
||||||
$name = $event->getName();
|
$name = $event->getName();
|
||||||
$description = $event->getDescription();
|
$description = $event->getDescription();
|
||||||
$type = $event->getStatus();
|
|
||||||
$is_all_day = $event->getIsAllDay();
|
$is_all_day = $event->getIsAllDay();
|
||||||
|
|
||||||
$current_policies = id(new PhabricatorPolicyQuery())
|
$current_policies = id(new PhabricatorPolicyQuery())
|
||||||
@@ -84,7 +83,6 @@ final class PhabricatorCalendarEventEditController
|
|||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
$xactions = array();
|
$xactions = array();
|
||||||
$name = $request->getStr('name');
|
$name = $request->getStr('name');
|
||||||
$type = $request->getInt('status');
|
|
||||||
|
|
||||||
$start_value = AphrontFormDateControlValue::newFromRequest(
|
$start_value = AphrontFormDateControlValue::newFromRequest(
|
||||||
$request,
|
$request,
|
||||||
@@ -128,11 +126,6 @@ final class PhabricatorCalendarEventEditController
|
|||||||
PhabricatorCalendarEventTransaction::TYPE_END_DATE)
|
PhabricatorCalendarEventTransaction::TYPE_END_DATE)
|
||||||
->setNewValue($end_value);
|
->setNewValue($end_value);
|
||||||
|
|
||||||
$xactions[] = id(new PhabricatorCalendarEventTransaction())
|
|
||||||
->setTransactionType(
|
|
||||||
PhabricatorCalendarEventTransaction::TYPE_STATUS)
|
|
||||||
->setNewValue($type);
|
|
||||||
|
|
||||||
$xactions[] = id(new PhabricatorCalendarEventTransaction())
|
$xactions[] = id(new PhabricatorCalendarEventTransaction())
|
||||||
->setTransactionType(
|
->setTransactionType(
|
||||||
PhabricatorTransactions::TYPE_SUBSCRIBERS)
|
PhabricatorTransactions::TYPE_SUBSCRIBERS)
|
||||||
@@ -195,12 +188,6 @@ final class PhabricatorCalendarEventEditController
|
|||||||
->setValue($name)
|
->setValue($name)
|
||||||
->setError($error_name);
|
->setError($error_name);
|
||||||
|
|
||||||
$status_select = id(new AphrontFormSelectControl())
|
|
||||||
->setLabel(pht('Status'))
|
|
||||||
->setName('status')
|
|
||||||
->setValue($type)
|
|
||||||
->setOptions($event->getStatusOptions());
|
|
||||||
|
|
||||||
$all_day_checkbox = id(new AphrontFormCheckboxControl())
|
$all_day_checkbox = id(new AphrontFormCheckboxControl())
|
||||||
->addCheckbox(
|
->addCheckbox(
|
||||||
'isAllDay',
|
'isAllDay',
|
||||||
@@ -262,7 +249,6 @@ final class PhabricatorCalendarEventEditController
|
|||||||
$form = id(new AphrontFormView())
|
$form = id(new AphrontFormView())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->appendChild($name)
|
->appendChild($name)
|
||||||
->appendChild($status_select)
|
|
||||||
->appendChild($all_day_checkbox)
|
->appendChild($all_day_checkbox)
|
||||||
->appendChild($start_control)
|
->appendChild($start_control)
|
||||||
->appendChild($end_control)
|
->appendChild($end_control)
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ final class PhabricatorCalendarEventEditor
|
|||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_NAME;
|
$types[] = PhabricatorCalendarEventTransaction::TYPE_NAME;
|
||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_START_DATE;
|
$types[] = PhabricatorCalendarEventTransaction::TYPE_START_DATE;
|
||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_END_DATE;
|
$types[] = PhabricatorCalendarEventTransaction::TYPE_END_DATE;
|
||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_STATUS;
|
|
||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION;
|
$types[] = PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION;
|
||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_CANCEL;
|
$types[] = PhabricatorCalendarEventTransaction::TYPE_CANCEL;
|
||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_INVITE;
|
$types[] = PhabricatorCalendarEventTransaction::TYPE_INVITE;
|
||||||
@@ -40,12 +39,6 @@ final class PhabricatorCalendarEventEditor
|
|||||||
return $object->getDateFrom();
|
return $object->getDateFrom();
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
||||||
return $object->getDateTo();
|
return $object->getDateTo();
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_STATUS:
|
|
||||||
$status = $object->getStatus();
|
|
||||||
if ($status === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (int)$status;
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
|
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
|
||||||
return $object->getDescription();
|
return $object->getDescription();
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
|
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
|
||||||
@@ -83,8 +76,6 @@ final class PhabricatorCalendarEventEditor
|
|||||||
return $xaction->getNewValue();
|
return $xaction->getNewValue();
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY:
|
case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY:
|
||||||
return (int)$xaction->getNewValue();
|
return (int)$xaction->getNewValue();
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_STATUS:
|
|
||||||
return (int)$xaction->getNewValue();
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
||||||
return $xaction->getNewValue()->getEpoch();
|
return $xaction->getNewValue()->getEpoch();
|
||||||
@@ -107,9 +98,6 @@ final class PhabricatorCalendarEventEditor
|
|||||||
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
||||||
$object->setDateTo($xaction->getNewValue());
|
$object->setDateTo($xaction->getNewValue());
|
||||||
return;
|
return;
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_STATUS:
|
|
||||||
$object->setStatus($xaction->getNewValue());
|
|
||||||
return;
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
|
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
|
||||||
$object->setDescription($xaction->getNewValue());
|
$object->setDescription($xaction->getNewValue());
|
||||||
return;
|
return;
|
||||||
@@ -139,7 +127,6 @@ final class PhabricatorCalendarEventEditor
|
|||||||
case PhabricatorCalendarEventTransaction::TYPE_NAME:
|
case PhabricatorCalendarEventTransaction::TYPE_NAME:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_STATUS:
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
|
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
|
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY:
|
case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY:
|
||||||
@@ -184,7 +171,9 @@ final class PhabricatorCalendarEventEditor
|
|||||||
return $xactions;
|
return $xactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function applyFinalEffects($object, array $xactions) {
|
protected function applyFinalEffects(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
array $xactions) {
|
||||||
|
|
||||||
// Clear the availability caches for users whose availability is affected
|
// Clear the availability caches for users whose availability is affected
|
||||||
// by this edit.
|
// by this edit.
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||||||
protected $userPHID;
|
protected $userPHID;
|
||||||
protected $dateFrom;
|
protected $dateFrom;
|
||||||
protected $dateTo;
|
protected $dateTo;
|
||||||
protected $status;
|
|
||||||
protected $description;
|
protected $description;
|
||||||
protected $isCancelled;
|
protected $isCancelled;
|
||||||
protected $isAllDay;
|
protected $isAllDay;
|
||||||
@@ -26,9 +25,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||||||
private $invitees = self::ATTACHABLE;
|
private $invitees = self::ATTACHABLE;
|
||||||
private $appliedViewer;
|
private $appliedViewer;
|
||||||
|
|
||||||
const STATUS_AWAY = 1;
|
|
||||||
const STATUS_SPORADIC = 2;
|
|
||||||
|
|
||||||
public static function initializeNewCalendarEvent(PhabricatorUser $actor) {
|
public static function initializeNewCalendarEvent(PhabricatorUser $actor) {
|
||||||
$app = id(new PhabricatorApplicationQuery())
|
$app = id(new PhabricatorApplicationQuery())
|
||||||
->setViewer($actor)
|
->setViewer($actor)
|
||||||
@@ -160,27 +156,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||||||
return ($this->getDateFrom() - phutil_units('15 minutes in seconds'));
|
return ($this->getDateFrom() - phutil_units('15 minutes in seconds'));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static $statusTexts = array(
|
|
||||||
self::STATUS_AWAY => 'away',
|
|
||||||
self::STATUS_SPORADIC => 'sporadic',
|
|
||||||
);
|
|
||||||
|
|
||||||
public function setTextStatus($status) {
|
|
||||||
$statuses = array_flip(self::$statusTexts);
|
|
||||||
return $this->setStatus($statuses[$status]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTextStatus() {
|
|
||||||
return self::$statusTexts[$this->status];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getStatusOptions() {
|
|
||||||
return array(
|
|
||||||
self::STATUS_AWAY => pht('Away'),
|
|
||||||
self::STATUS_SPORADIC => pht('Sporadic'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getConfiguration() {
|
protected function getConfiguration() {
|
||||||
return array(
|
return array(
|
||||||
self::CONFIG_AUX_PHID => true,
|
self::CONFIG_AUX_PHID => true,
|
||||||
@@ -188,7 +163,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||||||
'name' => 'text',
|
'name' => 'text',
|
||||||
'dateFrom' => 'epoch',
|
'dateFrom' => 'epoch',
|
||||||
'dateTo' => 'epoch',
|
'dateTo' => 'epoch',
|
||||||
'status' => 'uint32',
|
|
||||||
'description' => 'text',
|
'description' => 'text',
|
||||||
'isCancelled' => 'bool',
|
'isCancelled' => 'bool',
|
||||||
'isAllDay' => 'bool',
|
'isAllDay' => 'bool',
|
||||||
@@ -211,26 +185,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||||||
return 'E'.$this->getID();
|
return 'E'.$this->getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTerseSummary(PhabricatorUser $viewer) {
|
|
||||||
$until = phabricator_date($this->dateTo, $viewer);
|
|
||||||
if ($this->status == self::STATUS_SPORADIC) {
|
|
||||||
return pht('Sporadic until %s', $until);
|
|
||||||
} else {
|
|
||||||
return pht('Away until %s', $until);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getNameForStatus($value) {
|
|
||||||
switch ($value) {
|
|
||||||
case self::STATUS_AWAY:
|
|
||||||
return pht('Away');
|
|
||||||
case self::STATUS_SPORADIC:
|
|
||||||
return pht('Sporadic');
|
|
||||||
default:
|
|
||||||
return pht('Unknown');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getInvitees() {
|
public function getInvitees() {
|
||||||
return $this->assertAttached($this->invitees);
|
return $this->assertAttached($this->invitees);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ final class PhabricatorCalendarEventTransaction
|
|||||||
const TYPE_NAME = 'calendar.name';
|
const TYPE_NAME = 'calendar.name';
|
||||||
const TYPE_START_DATE = 'calendar.startdate';
|
const TYPE_START_DATE = 'calendar.startdate';
|
||||||
const TYPE_END_DATE = 'calendar.enddate';
|
const TYPE_END_DATE = 'calendar.enddate';
|
||||||
const TYPE_STATUS = 'calendar.status';
|
|
||||||
const TYPE_DESCRIPTION = 'calendar.description';
|
const TYPE_DESCRIPTION = 'calendar.description';
|
||||||
const TYPE_CANCEL = 'calendar.cancel';
|
const TYPE_CANCEL = 'calendar.cancel';
|
||||||
const TYPE_ALL_DAY = 'calendar.allday';
|
const TYPE_ALL_DAY = 'calendar.allday';
|
||||||
@@ -35,7 +34,6 @@ final class PhabricatorCalendarEventTransaction
|
|||||||
case self::TYPE_NAME:
|
case self::TYPE_NAME:
|
||||||
case self::TYPE_START_DATE:
|
case self::TYPE_START_DATE:
|
||||||
case self::TYPE_END_DATE:
|
case self::TYPE_END_DATE:
|
||||||
case self::TYPE_STATUS:
|
|
||||||
case self::TYPE_DESCRIPTION:
|
case self::TYPE_DESCRIPTION:
|
||||||
case self::TYPE_CANCEL:
|
case self::TYPE_CANCEL:
|
||||||
case self::TYPE_ALL_DAY:
|
case self::TYPE_ALL_DAY:
|
||||||
@@ -57,7 +55,6 @@ final class PhabricatorCalendarEventTransaction
|
|||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_START_DATE:
|
case self::TYPE_START_DATE:
|
||||||
case self::TYPE_END_DATE:
|
case self::TYPE_END_DATE:
|
||||||
case self::TYPE_STATUS:
|
|
||||||
case self::TYPE_DESCRIPTION:
|
case self::TYPE_DESCRIPTION:
|
||||||
case self::TYPE_CANCEL:
|
case self::TYPE_CANCEL:
|
||||||
case self::TYPE_ALL_DAY:
|
case self::TYPE_ALL_DAY:
|
||||||
@@ -72,7 +69,6 @@ final class PhabricatorCalendarEventTransaction
|
|||||||
case self::TYPE_NAME:
|
case self::TYPE_NAME:
|
||||||
case self::TYPE_START_DATE:
|
case self::TYPE_START_DATE:
|
||||||
case self::TYPE_END_DATE:
|
case self::TYPE_END_DATE:
|
||||||
case self::TYPE_STATUS:
|
|
||||||
case self::TYPE_DESCRIPTION:
|
case self::TYPE_DESCRIPTION:
|
||||||
case self::TYPE_ALL_DAY:
|
case self::TYPE_ALL_DAY:
|
||||||
case self::TYPE_CANCEL:
|
case self::TYPE_CANCEL:
|
||||||
@@ -120,14 +116,6 @@ final class PhabricatorCalendarEventTransaction
|
|||||||
$this->renderHandleLink($author_phid));
|
$this->renderHandleLink($author_phid));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case self::TYPE_STATUS:
|
|
||||||
$old_name = PhabricatorCalendarEvent::getNameForStatus($old);
|
|
||||||
$new_name = PhabricatorCalendarEvent::getNameForStatus($new);
|
|
||||||
return pht(
|
|
||||||
'%s updated the event status from %s to %s.',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$old_name,
|
|
||||||
$new_name);
|
|
||||||
case self::TYPE_DESCRIPTION:
|
case self::TYPE_DESCRIPTION:
|
||||||
return pht(
|
return pht(
|
||||||
"%s updated the event's description.",
|
"%s updated the event's description.",
|
||||||
@@ -287,15 +275,6 @@ final class PhabricatorCalendarEventTransaction
|
|||||||
$new);
|
$new);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case self::TYPE_STATUS:
|
|
||||||
$old_name = PhabricatorCalendarEvent::getNameForStatus($old);
|
|
||||||
$new_name = PhabricatorCalendarEvent::getNameForStatus($new);
|
|
||||||
return pht(
|
|
||||||
'%s updated the status of %s from %s to %s.',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$this->renderHandleLink($object_phid),
|
|
||||||
$old_name,
|
|
||||||
$new_name);
|
|
||||||
case self::TYPE_DESCRIPTION:
|
case self::TYPE_DESCRIPTION:
|
||||||
return pht(
|
return pht(
|
||||||
'%s updated the description of %s.',
|
'%s updated the description of %s.',
|
||||||
@@ -430,7 +409,6 @@ final class PhabricatorCalendarEventTransaction
|
|||||||
case self::TYPE_NAME:
|
case self::TYPE_NAME:
|
||||||
case self::TYPE_START_DATE:
|
case self::TYPE_START_DATE:
|
||||||
case self::TYPE_END_DATE:
|
case self::TYPE_END_DATE:
|
||||||
case self::TYPE_STATUS:
|
|
||||||
case self::TYPE_DESCRIPTION:
|
case self::TYPE_DESCRIPTION:
|
||||||
case self::TYPE_CANCEL:
|
case self::TYPE_CANCEL:
|
||||||
case self::TYPE_INVITE:
|
case self::TYPE_INVITE:
|
||||||
@@ -469,7 +447,6 @@ final class PhabricatorCalendarEventTransaction
|
|||||||
$tags = array();
|
$tags = array();
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_NAME:
|
case self::TYPE_NAME:
|
||||||
case self::TYPE_STATUS:
|
|
||||||
case self::TYPE_DESCRIPTION:
|
case self::TYPE_DESCRIPTION:
|
||||||
case self::TYPE_INVITE:
|
case self::TYPE_INVITE:
|
||||||
$tags[] = self::MAILTAG_CONTENT;
|
$tags[] = self::MAILTAG_CONTENT;
|
||||||
|
|||||||
@@ -218,7 +218,11 @@ final class ConpherenceWidgetController extends ConpherenceController {
|
|||||||
$conpherence = $this->getConpherence();
|
$conpherence = $this->getConpherence();
|
||||||
$participants = $conpherence->getParticipants();
|
$participants = $conpherence->getParticipants();
|
||||||
$widget_data = $conpherence->getWidgetData();
|
$widget_data = $conpherence->getWidgetData();
|
||||||
$statuses = $widget_data['statuses'];
|
|
||||||
|
// TODO: This panel is built around an outdated notion of events and isn't
|
||||||
|
// invitee-aware.
|
||||||
|
|
||||||
|
$statuses = $widget_data['events'];
|
||||||
$handles = $conpherence->getHandles();
|
$handles = $conpherence->getHandles();
|
||||||
$content = array();
|
$content = array();
|
||||||
$layout = id(new AphrontMultiColumnView())
|
$layout = id(new AphrontMultiColumnView())
|
||||||
@@ -312,7 +316,7 @@ final class ConpherenceWidgetController extends ConpherenceController {
|
|||||||
$content[] = phutil_tag(
|
$content[] = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'user-status '.$status->getTextStatus().$top_border,
|
'class' => 'user-status '.$top_border,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
@@ -327,7 +331,7 @@ final class ConpherenceWidgetController extends ConpherenceController {
|
|||||||
'class' => 'description',
|
'class' => 'description',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
$status->getTerseSummary($user),
|
$status->getName(),
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
@@ -359,9 +363,7 @@ final class ConpherenceWidgetController extends ConpherenceController {
|
|||||||
if ($status) {
|
if ($status) {
|
||||||
$inner_layout[] = phutil_tag(
|
$inner_layout[] = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(),
|
||||||
'class' => $status->getTextStatus(),
|
|
||||||
),
|
|
||||||
'');
|
'');
|
||||||
} else {
|
} else {
|
||||||
$inner_layout[] = phutil_tag(
|
$inner_layout[] = phutil_tag(
|
||||||
|
|||||||
@@ -354,13 +354,25 @@ final class ConpherenceThreadQuery
|
|||||||
$this->getViewer());
|
$this->getViewer());
|
||||||
$start_epoch = $epochs['start_epoch'];
|
$start_epoch = $epochs['start_epoch'];
|
||||||
$end_epoch = $epochs['end_epoch'];
|
$end_epoch = $epochs['end_epoch'];
|
||||||
$statuses = id(new PhabricatorCalendarEventQuery())
|
|
||||||
->setViewer($this->getViewer())
|
|
||||||
->withInvitedPHIDs($participant_phids)
|
|
||||||
->withDateRange($start_epoch, $end_epoch)
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
$statuses = mgroup($statuses, 'getUserPHID');
|
if ($participant_phids) {
|
||||||
|
$events = id(new PhabricatorCalendarEventQuery())
|
||||||
|
->setViewer($this->getViewer())
|
||||||
|
->withInvitedPHIDs($participant_phids)
|
||||||
|
->withIsCancelled(false)
|
||||||
|
->withDateRange($start_epoch, $end_epoch)
|
||||||
|
->execute();
|
||||||
|
$events = mpull($events, null, 'getPHID');
|
||||||
|
} else {
|
||||||
|
$events = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$invitees = array();
|
||||||
|
foreach ($events as $event_phid => $event) {
|
||||||
|
foreach ($event->getInvitees() as $invitee) {
|
||||||
|
$invitees[$invitee->getInviteePHID()][$event_phid] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// attached files
|
// attached files
|
||||||
$files = array();
|
$files = array();
|
||||||
@@ -382,9 +394,16 @@ final class ConpherenceThreadQuery
|
|||||||
|
|
||||||
foreach ($conpherences as $phid => $conpherence) {
|
foreach ($conpherences as $phid => $conpherence) {
|
||||||
$participant_phids = array_keys($conpherence->getParticipants());
|
$participant_phids = array_keys($conpherence->getParticipants());
|
||||||
$statuses = array_select_keys($statuses, $participant_phids);
|
$widget_data = array();
|
||||||
$statuses = array_mergev($statuses);
|
|
||||||
$statuses = msort($statuses, 'getDateFrom');
|
$event_phids = array();
|
||||||
|
$participant_invites = array_select_keys($invitees, $participant_phids);
|
||||||
|
foreach ($participant_invites as $invite_set) {
|
||||||
|
$event_phids += $invite_set;
|
||||||
|
}
|
||||||
|
$thread_events = array_select_keys($events, array_keys($event_phids));
|
||||||
|
$thread_events = msort($thread_events, 'getDateFrom');
|
||||||
|
$widget_data['events'] = $thread_events;
|
||||||
|
|
||||||
$conpherence_files = array();
|
$conpherence_files = array();
|
||||||
$files_authors = array();
|
$files_authors = array();
|
||||||
@@ -404,11 +423,11 @@ final class ConpherenceThreadQuery
|
|||||||
}
|
}
|
||||||
$files_authors[$curr_phid] = $current_author;
|
$files_authors[$curr_phid] = $current_author;
|
||||||
}
|
}
|
||||||
$widget_data = array(
|
$widget_data += array(
|
||||||
'statuses' => $statuses,
|
|
||||||
'files' => $conpherence_files,
|
'files' => $conpherence_files,
|
||||||
'files_authors' => $files_authors,
|
'files_authors' => $files_authors,
|
||||||
);
|
);
|
||||||
|
|
||||||
$conpherence->attachWidgetData($widget_data);
|
$conpherence->attachWidgetData($widget_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
final class UserAddStatusConduitAPIMethod extends UserConduitAPIMethod {
|
|
||||||
|
|
||||||
public function getAPIMethodName() {
|
|
||||||
return 'user.addstatus';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMethodStatus() {
|
|
||||||
return self::METHOD_STATUS_DEPRECATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMethodDescription() {
|
|
||||||
return pht('Add status information to the logged-in user.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMethodStatusDescription() {
|
|
||||||
return pht(
|
|
||||||
'Statuses are becoming full-fledged events as part of the '.
|
|
||||||
'Calendar application.');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function defineParamTypes() {
|
|
||||||
$status_const = $this->formatStringConstants(array('away', 'sporadic'));
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'fromEpoch' => 'required int',
|
|
||||||
'toEpoch' => 'required int',
|
|
||||||
'status' => 'required '.$status_const,
|
|
||||||
'description' => 'optional string',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function defineReturnType() {
|
|
||||||
return 'void';
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function defineErrorTypes() {
|
|
||||||
return array(
|
|
||||||
'ERR-BAD-EPOCH' => "'toEpoch' must be bigger than 'fromEpoch'.",
|
|
||||||
'ERR-OVERLAP' =>
|
|
||||||
'There must be no status in any part of the specified epoch.',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(ConduitAPIRequest $request) {
|
|
||||||
$user_phid = $request->getUser()->getPHID();
|
|
||||||
$from = $request->getValue('fromEpoch');
|
|
||||||
$to = $request->getValue('toEpoch');
|
|
||||||
$status = $request->getValue('status');
|
|
||||||
$description = $request->getValue('description', '');
|
|
||||||
|
|
||||||
id(new PhabricatorCalendarEvent())
|
|
||||||
->setUserPHID($user_phid)
|
|
||||||
->setDateFrom($from)
|
|
||||||
->setDateTo($to)
|
|
||||||
->setTextStatus($status)
|
|
||||||
->setDescription($description)
|
|
||||||
->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
final class UserRemoveStatusConduitAPIMethod extends UserConduitAPIMethod {
|
|
||||||
|
|
||||||
public function getAPIMethodName() {
|
|
||||||
return 'user.removestatus';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMethodStatus() {
|
|
||||||
return self::METHOD_STATUS_DEPRECATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMethodDescription() {
|
|
||||||
return pht('Delete status information of the logged-in user.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMethodStatusDescription() {
|
|
||||||
return pht(
|
|
||||||
'Statuses are becoming full-fledged events as part of the '.
|
|
||||||
'Calendar application.');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function defineParamTypes() {
|
|
||||||
return array(
|
|
||||||
'fromEpoch' => 'required int',
|
|
||||||
'toEpoch' => 'required int',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function defineReturnType() {
|
|
||||||
return 'int';
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function defineErrorTypes() {
|
|
||||||
return array(
|
|
||||||
'ERR-BAD-EPOCH' => "'toEpoch' must be bigger than 'fromEpoch'.",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(ConduitAPIRequest $request) {
|
|
||||||
$user_phid = $request->getUser()->getPHID();
|
|
||||||
$from = $request->getValue('fromEpoch');
|
|
||||||
$to = $request->getValue('toEpoch');
|
|
||||||
|
|
||||||
if ($to <= $from) {
|
|
||||||
throw new ConduitException('ERR-BAD-EPOCH');
|
|
||||||
}
|
|
||||||
|
|
||||||
$table = new PhabricatorCalendarEvent();
|
|
||||||
$table->openTransaction();
|
|
||||||
$table->beginReadLocking();
|
|
||||||
|
|
||||||
$overlap = $table->loadAllWhere(
|
|
||||||
'userPHID = %s AND dateFrom < %d AND dateTo > %d',
|
|
||||||
$user_phid,
|
|
||||||
$to,
|
|
||||||
$from);
|
|
||||||
foreach ($overlap as $status) {
|
|
||||||
if ($status->getDateFrom() < $from) {
|
|
||||||
if ($status->getDateTo() > $to) {
|
|
||||||
// Split the interval.
|
|
||||||
id(new PhabricatorCalendarEvent())
|
|
||||||
->setUserPHID($user_phid)
|
|
||||||
->setDateFrom($to)
|
|
||||||
->setDateTo($status->getDateTo())
|
|
||||||
->setStatus($status->getStatus())
|
|
||||||
->setDescription($status->getDescription())
|
|
||||||
->save();
|
|
||||||
}
|
|
||||||
$status->setDateTo($from);
|
|
||||||
$status->save();
|
|
||||||
} else if ($status->getDateTo() > $to) {
|
|
||||||
$status->setDateFrom($to);
|
|
||||||
$status->save();
|
|
||||||
} else {
|
|
||||||
$status->delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->endReadLocking();
|
|
||||||
$table->saveTransaction();
|
|
||||||
return count($overlap);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user