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.
$user = id(new PhabricatorPeopleQuery())
->setViewer($viewer)
->withPHIDs(array($event->getUserPHID()))
->withPHIDs(array($event->getHostPHID()))
->executeOne();
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(
pht('Host'),
$viewer->renderHandle($event->getUserPHID()));
$viewer->renderHandle($event->getHostPHID()));
$invitees = $event->getInvitees();
foreach ($invitees as $key => $invitee) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -46,7 +46,7 @@ final class DifferentialInlineCommentEditController
throw new Exception(
pht(
'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,
$diff->getID(),
$diff->getRevisionID(),