1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 03:20:59 +01:00

Rename Event "userPHID" to "hostPHID"

Summary: Ref T10909. Ref T9224. We label this field "Host" in the UI; make the storage format consistent.

Test Plan:
  - Viewed month view, day view, detail view of an event.
  - Created a new event, saw myself as the host.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9224, T10909

Differential Revision: https://secure.phabricator.com/D16291
This commit is contained in:
epriestley 2016-07-13 11:33:43 -07:00
parent 8062423271
commit b6daa049de
10 changed files with 34 additions and 41 deletions

View file

@ -17,7 +17,7 @@ foreach ($iterator as $event) {
// later patch. See T8209. // later patch. See T8209.
$user = id(new PhabricatorPeopleQuery()) $user = id(new PhabricatorPeopleQuery())
->setViewer($viewer) ->setViewer($viewer)
->withPHIDs(array($event->getUserPHID())) ->withPHIDs(array($event->getHostPHID()))
->executeOne(); ->executeOne();
if ($user) { if ($user) {

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_calendar.calendar_event
CHANGE userPHID hostPHID VARBINARY(64) NOT NULL;

View file

@ -245,7 +245,7 @@ final class PhabricatorCalendarEventViewController
$properties->addProperty( $properties->addProperty(
pht('Host'), pht('Host'),
$viewer->renderHandle($event->getUserPHID())); $viewer->renderHandle($event->getHostPHID()));
$invitees = $event->getInvitees(); $invitees = $event->getInvitees();
foreach ($invitees as $key => $invitee) { foreach ($invitees as $key => $invitee) {

View file

@ -197,8 +197,8 @@ final class PhabricatorCalendarEventEditor
protected function getMailTo(PhabricatorLiskDAO $object) { protected function getMailTo(PhabricatorLiskDAO $object) {
$phids = array(); $phids = array();
if ($object->getUserPHID()) { if ($object->getHostPHID()) {
$phids[] = $object->getUserPHID(); $phids[] = $object->getHostPHID();
} }
$phids[] = $this->getActingAsPHID(); $phids[] = $this->getActingAsPHID();

View file

@ -248,16 +248,6 @@ final class PhabricatorCalendarEventSearchEngine
return parent::buildSavedQueryFromBuiltin($query_key); return parent::buildSavedQueryFromBuiltin($query_key);
} }
protected function getRequiredHandlePHIDsForResultList(
array $objects,
PhabricatorSavedQuery $query) {
$phids = array();
foreach ($objects as $event) {
$phids[$event->getUserPHID()] = 1;
}
return array_keys($phids);
}
protected function renderResultList( protected function renderResultList(
array $events, array $events,
PhabricatorSavedQuery $query, PhabricatorSavedQuery $query,
@ -275,7 +265,6 @@ final class PhabricatorCalendarEventSearchEngine
foreach ($events as $event) { foreach ($events as $event) {
$event_date_info = $this->getEventDateLabel($event); $event_date_info = $this->getEventDateLabel($event);
$creator_handle = $handles[$event->getUserPHID()];
$attendees = array(); $attendees = array();
foreach ($event->getInvitees() as $invitee) { foreach ($event->getInvitees() as $invitee) {
@ -364,7 +353,8 @@ final class PhabricatorCalendarEventSearchEngine
$month_view->setUser($viewer); $month_view->setUser($viewer);
$phids = mpull($statuses, 'getUserPHID'); $phids = mpull($statuses, 'getHostPHID');
$handles = $viewer->loadHandles($phids);
foreach ($statuses as $status) { foreach ($statuses as $status) {
$viewer_is_invited = $status->getIsUserInvited($viewer->getPHID()); $viewer_is_invited = $status->getIsUserInvited($viewer->getPHID());
@ -376,9 +366,9 @@ final class PhabricatorCalendarEventSearchEngine
$event->setIsAllDay($status->getIsAllDay()); $event->setIsAllDay($status->getIsAllDay());
$event->setIcon($status->getIcon()); $event->setIcon($status->getIcon());
$name_text = $handles[$status->getUserPHID()]->getName(); $name_text = $handles[$status->getHostPHID()]->getName();
$status_text = $status->getName(); $status_text = $status->getName();
$event->setUserPHID($status->getUserPHID()); $event->setHostPHID($status->getHostPHID());
$event->setDescription(pht('%s (%s)', $name_text, $status_text)); $event->setDescription(pht('%s (%s)', $name_text, $status_text));
$event->setName($status_text); $event->setName($status_text);
$event->setURI($status->getURI()); $event->setURI($status->getURI());
@ -419,7 +409,7 @@ final class PhabricatorCalendarEventSearchEngine
$day_view->setUser($viewer); $day_view->setUser($viewer);
$phids = mpull($statuses, 'getUserPHID'); $phids = mpull($statuses, 'getHostPHID');
foreach ($statuses as $status) { foreach ($statuses as $status) {
if ($status->getIsCancelled()) { if ($status->getIsCancelled()) {

View file

@ -17,13 +17,13 @@ final class PhabricatorCalendarEventFulltextEngine
$document->addRelationship( $document->addRelationship(
PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
$event->getUserPHID(), $event->getHostPHID(),
PhabricatorPeopleUserPHIDType::TYPECONST, PhabricatorPeopleUserPHIDType::TYPECONST,
$event->getDateCreated()); $event->getDateCreated());
$document->addRelationship( $document->addRelationship(
PhabricatorSearchRelationship::RELATIONSHIP_OWNER, PhabricatorSearchRelationship::RELATIONSHIP_OWNER,
$event->getUserPHID(), $event->getHostPHID(),
PhabricatorPeopleUserPHIDType::TYPECONST, PhabricatorPeopleUserPHIDType::TYPECONST,
$event->getDateCreated()); $event->getDateCreated());

View file

@ -16,7 +16,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
PhabricatorConduitResultInterface { PhabricatorConduitResultInterface {
protected $name; protected $name;
protected $userPHID; protected $hostPHID;
protected $dateFrom; protected $dateFrom;
protected $dateTo; protected $dateTo;
protected $description; protected $description;
@ -83,7 +83,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
$epoch_max = $end->format('U'); $epoch_max = $end->format('U');
return id(new PhabricatorCalendarEvent()) return id(new PhabricatorCalendarEvent())
->setUserPHID($actor->getPHID()) ->setHostPHID($actor->getPHID())
->setIsCancelled(0) ->setIsCancelled(0)
->setIsAllDay(0) ->setIsAllDay(0)
->setIsStub(0) ->setIsStub(0)
@ -120,7 +120,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
protected function readField($field) { protected function readField($field) {
static $inherit = array( static $inherit = array(
'userPHID' => true, 'hostPHID' => true,
'isAllDay' => true, 'isAllDay' => true,
'icon' => true, 'icon' => true,
'spacePHID' => true, 'spacePHID' => true,
@ -156,7 +156,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
$parent = $this->getParentEvent(); $parent = $this->getParentEvent();
$this $this
->setUserPHID($parent->getUserPHID()) ->setHostPHID($parent->getHostPHID())
->setIsAllDay($parent->getIsAllDay()) ->setIsAllDay($parent->getIsAllDay())
->setIcon($parent->getIcon()) ->setIcon($parent->getIcon())
->setSpacePHID($parent->getSpacePHID()) ->setSpacePHID($parent->getSpacePHID())
@ -311,8 +311,8 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
'isStub' => 'bool', 'isStub' => 'bool',
), ),
self::CONFIG_KEY_SCHEMA => array( self::CONFIG_KEY_SCHEMA => array(
'userPHID_dateFrom' => array( 'key_date' => array(
'columns' => array('userPHID', 'dateTo'), 'columns' => array('dateFrom', 'dateTo'),
), ),
'key_instance' => array( 'key_instance' => array(
'columns' => array('instanceOfEventPHID', 'sequenceIndex'), 'columns' => array('instanceOfEventPHID', 'sequenceIndex'),
@ -545,8 +545,8 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
} }
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
// The owner of a task can always view and edit it. // The host of an event can always view and edit it.
$user_phid = $this->getUserPHID(); $user_phid = $this->getHostPHID();
if ($user_phid) { if ($user_phid) {
$viewer_phid = $viewer->getPHID(); $viewer_phid = $viewer->getPHID();
if ($viewer_phid == $user_phid) { if ($viewer_phid == $user_phid) {
@ -567,11 +567,12 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
} }
public function describeAutomaticCapability($capability) { public function describeAutomaticCapability($capability) {
return pht('The owner of an event can always view and edit it, return pht(
and invitees can always view it, except if the event is an 'The host of an event can always view and edit it. Users who are '.
instance of a recurring event.'); 'invited to an event can always view it.');
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */ /* -( PhabricatorApplicationTransactionInterface )------------------------- */
@ -598,14 +599,14 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
public function isAutomaticallySubscribed($phid) { public function isAutomaticallySubscribed($phid) {
return ($phid == $this->getUserPHID()); return ($phid == $this->getHostPHID());
} }
/* -( PhabricatorTokenReceiverInterface )---------------------------------- */ /* -( PhabricatorTokenReceiverInterface )---------------------------------- */
public function getUsersToNotifyOfTokenGiven() { public function getUsersToNotifyOfTokenGiven() {
return array($this->getUserPHID()); return array($this->getHostPHID());
} }
/* -( PhabricatorDestructibleInterface )----------------------------------- */ /* -( PhabricatorDestructibleInterface )----------------------------------- */

View file

@ -2,7 +2,7 @@
final class AphrontCalendarEventView extends AphrontView { final class AphrontCalendarEventView extends AphrontView {
private $userPHID; private $hostPHID;
private $name; private $name;
private $epochStart; private $epochStart;
private $epochEnd; private $epochEnd;
@ -39,13 +39,13 @@ final class AphrontCalendarEventView extends AphrontView {
return $this->viewerIsInvited; return $this->viewerIsInvited;
} }
public function setUserPHID($user_phid) { public function setHostPHID($host_phid) {
$this->userPHID = $user_phid; $this->hostPHID = $host_phid;
return $this; return $this;
} }
public function getUserPHID() { public function getHostPHID() {
return $this->userPHID; return $this->hostPHID;
} }
public function setName($name) { public function setName($name) {

View file

@ -22,7 +22,7 @@ final class PhabricatorCalendarEventRecurringTransaction
$old = $object->getIsRecurring(); $old = $object->getIsRecurring();
foreach ($xactions as $xaction) { foreach ($xactions as $xaction) {
if ($this->getIsNewObject()) { if ($this->isNewObject()) {
continue; continue;
} }

View file

@ -46,7 +46,7 @@ final class DifferentialInlineCommentEditController
throw new Exception( throw new Exception(
pht( pht(
'Changeset ID "%s" is part of diff ID "%s", but that diff '. 'Changeset ID "%s" is part of diff ID "%s", but that diff '.
'is attached to reivsion "%s", not revision "%s".', 'is attached to revision "%s", not revision "%s".',
$changeset_id, $changeset_id,
$diff->getID(), $diff->getID(),
$diff->getRevisionID(), $diff->getRevisionID(),