@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

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

+34 -41
+1 -1
resources/sql/autopatches/20150506.calendarunnamedevents.1.php
··· 17 17 // later patch. See T8209. 18 18 $user = id(new PhabricatorPeopleQuery()) 19 19 ->setViewer($viewer) 20 - ->withPHIDs(array($event->getUserPHID())) 20 + ->withPHIDs(array($event->getHostPHID())) 21 21 ->executeOne(); 22 22 23 23 if ($user) {
+2
resources/sql/autopatches/20160713.event.01.host.sql
··· 1 + ALTER TABLE {$NAMESPACE}_calendar.calendar_event 2 + CHANGE userPHID hostPHID VARBINARY(64) NOT NULL;
+1 -1
src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
··· 245 245 246 246 $properties->addProperty( 247 247 pht('Host'), 248 - $viewer->renderHandle($event->getUserPHID())); 248 + $viewer->renderHandle($event->getHostPHID())); 249 249 250 250 $invitees = $event->getInvitees(); 251 251 foreach ($invitees as $key => $invitee) {
+2 -2
src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
··· 197 197 protected function getMailTo(PhabricatorLiskDAO $object) { 198 198 $phids = array(); 199 199 200 - if ($object->getUserPHID()) { 201 - $phids[] = $object->getUserPHID(); 200 + if ($object->getHostPHID()) { 201 + $phids[] = $object->getHostPHID(); 202 202 } 203 203 $phids[] = $this->getActingAsPHID(); 204 204
+5 -15
src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
··· 248 248 return parent::buildSavedQueryFromBuiltin($query_key); 249 249 } 250 250 251 - protected function getRequiredHandlePHIDsForResultList( 252 - array $objects, 253 - PhabricatorSavedQuery $query) { 254 - $phids = array(); 255 - foreach ($objects as $event) { 256 - $phids[$event->getUserPHID()] = 1; 257 - } 258 - return array_keys($phids); 259 - } 260 - 261 251 protected function renderResultList( 262 252 array $events, 263 253 PhabricatorSavedQuery $query, ··· 275 265 276 266 foreach ($events as $event) { 277 267 $event_date_info = $this->getEventDateLabel($event); 278 - $creator_handle = $handles[$event->getUserPHID()]; 279 268 $attendees = array(); 280 269 281 270 foreach ($event->getInvitees() as $invitee) { ··· 364 353 365 354 $month_view->setUser($viewer); 366 355 367 - $phids = mpull($statuses, 'getUserPHID'); 356 + $phids = mpull($statuses, 'getHostPHID'); 357 + $handles = $viewer->loadHandles($phids); 368 358 369 359 foreach ($statuses as $status) { 370 360 $viewer_is_invited = $status->getIsUserInvited($viewer->getPHID()); ··· 376 366 $event->setIsAllDay($status->getIsAllDay()); 377 367 $event->setIcon($status->getIcon()); 378 368 379 - $name_text = $handles[$status->getUserPHID()]->getName(); 369 + $name_text = $handles[$status->getHostPHID()]->getName(); 380 370 $status_text = $status->getName(); 381 - $event->setUserPHID($status->getUserPHID()); 371 + $event->setHostPHID($status->getHostPHID()); 382 372 $event->setDescription(pht('%s (%s)', $name_text, $status_text)); 383 373 $event->setName($status_text); 384 374 $event->setURI($status->getURI()); ··· 419 409 420 410 $day_view->setUser($viewer); 421 411 422 - $phids = mpull($statuses, 'getUserPHID'); 412 + $phids = mpull($statuses, 'getHostPHID'); 423 413 424 414 foreach ($statuses as $status) { 425 415 if ($status->getIsCancelled()) {
+2 -2
src/applications/calendar/search/PhabricatorCalendarEventFulltextEngine.php
··· 17 17 18 18 $document->addRelationship( 19 19 PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, 20 - $event->getUserPHID(), 20 + $event->getHostPHID(), 21 21 PhabricatorPeopleUserPHIDType::TYPECONST, 22 22 $event->getDateCreated()); 23 23 24 24 $document->addRelationship( 25 25 PhabricatorSearchRelationship::RELATIONSHIP_OWNER, 26 - $event->getUserPHID(), 26 + $event->getHostPHID(), 27 27 PhabricatorPeopleUserPHIDType::TYPECONST, 28 28 $event->getDateCreated()); 29 29
+14 -13
src/applications/calendar/storage/PhabricatorCalendarEvent.php
··· 16 16 PhabricatorConduitResultInterface { 17 17 18 18 protected $name; 19 - protected $userPHID; 19 + protected $hostPHID; 20 20 protected $dateFrom; 21 21 protected $dateTo; 22 22 protected $description; ··· 83 83 $epoch_max = $end->format('U'); 84 84 85 85 return id(new PhabricatorCalendarEvent()) 86 - ->setUserPHID($actor->getPHID()) 86 + ->setHostPHID($actor->getPHID()) 87 87 ->setIsCancelled(0) 88 88 ->setIsAllDay(0) 89 89 ->setIsStub(0) ··· 120 120 121 121 protected function readField($field) { 122 122 static $inherit = array( 123 - 'userPHID' => true, 123 + 'hostPHID' => true, 124 124 'isAllDay' => true, 125 125 'icon' => true, 126 126 'spacePHID' => true, ··· 156 156 $parent = $this->getParentEvent(); 157 157 158 158 $this 159 - ->setUserPHID($parent->getUserPHID()) 159 + ->setHostPHID($parent->getHostPHID()) 160 160 ->setIsAllDay($parent->getIsAllDay()) 161 161 ->setIcon($parent->getIcon()) 162 162 ->setSpacePHID($parent->getSpacePHID()) ··· 311 311 'isStub' => 'bool', 312 312 ), 313 313 self::CONFIG_KEY_SCHEMA => array( 314 - 'userPHID_dateFrom' => array( 315 - 'columns' => array('userPHID', 'dateTo'), 314 + 'key_date' => array( 315 + 'columns' => array('dateFrom', 'dateTo'), 316 316 ), 317 317 'key_instance' => array( 318 318 'columns' => array('instanceOfEventPHID', 'sequenceIndex'), ··· 545 545 } 546 546 547 547 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 548 - // The owner of a task can always view and edit it. 549 - $user_phid = $this->getUserPHID(); 548 + // The host of an event can always view and edit it. 549 + $user_phid = $this->getHostPHID(); 550 550 if ($user_phid) { 551 551 $viewer_phid = $viewer->getPHID(); 552 552 if ($viewer_phid == $user_phid) { ··· 567 567 } 568 568 569 569 public function describeAutomaticCapability($capability) { 570 - return pht('The owner of an event can always view and edit it, 571 - and invitees can always view it, except if the event is an 572 - instance of a recurring event.'); 570 + return pht( 571 + 'The host of an event can always view and edit it. Users who are '. 572 + 'invited to an event can always view it.'); 573 573 } 574 + 574 575 575 576 /* -( PhabricatorApplicationTransactionInterface )------------------------- */ 576 577 ··· 598 599 599 600 600 601 public function isAutomaticallySubscribed($phid) { 601 - return ($phid == $this->getUserPHID()); 602 + return ($phid == $this->getHostPHID()); 602 603 } 603 604 604 605 /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ 605 606 606 607 607 608 public function getUsersToNotifyOfTokenGiven() { 608 - return array($this->getUserPHID()); 609 + return array($this->getHostPHID()); 609 610 } 610 611 611 612 /* -( PhabricatorDestructibleInterface )----------------------------------- */
+5 -5
src/applications/calendar/view/AphrontCalendarEventView.php
··· 2 2 3 3 final class AphrontCalendarEventView extends AphrontView { 4 4 5 - private $userPHID; 5 + private $hostPHID; 6 6 private $name; 7 7 private $epochStart; 8 8 private $epochEnd; ··· 39 39 return $this->viewerIsInvited; 40 40 } 41 41 42 - public function setUserPHID($user_phid) { 43 - $this->userPHID = $user_phid; 42 + public function setHostPHID($host_phid) { 43 + $this->hostPHID = $host_phid; 44 44 return $this; 45 45 } 46 46 47 - public function getUserPHID() { 48 - return $this->userPHID; 47 + public function getHostPHID() { 48 + return $this->hostPHID; 49 49 } 50 50 51 51 public function setName($name) {
+1 -1
src/applications/calendar/xaction/PhabricatorCalendarEventRecurringTransaction.php
··· 22 22 23 23 $old = $object->getIsRecurring(); 24 24 foreach ($xactions as $xaction) { 25 - if ($this->getIsNewObject()) { 25 + if ($this->isNewObject()) { 26 26 continue; 27 27 } 28 28
+1 -1
src/applications/differential/controller/DifferentialInlineCommentEditController.php
··· 46 46 throw new Exception( 47 47 pht( 48 48 'Changeset ID "%s" is part of diff ID "%s", but that diff '. 49 - 'is attached to reivsion "%s", not revision "%s".', 49 + 'is attached to revision "%s", not revision "%s".', 50 50 $changeset_id, 51 51 $diff->getID(), 52 52 $diff->getRevisionID(),