mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-28 00:10:57 +01:00
Rename PhabricatorUserStatus to PhabricatorCalendarEvent
Summary: Ref T4375. We never join this table, so this is a pretty straight find/replace. Test Plan: Browsed around Calendar, verified that nothing seemed broken. Saw my red dot in other apps. Reviewers: btrahan, chad Reviewed By: btrahan CC: aran Maniphest Tasks: T4375 Differential Revision: https://secure.phabricator.com/D8145
This commit is contained in:
parent
980f06f3da
commit
ab636f36bf
23 changed files with 47 additions and 46 deletions
2
resources/sql/autopatches/20140205.cal.1.rename.sql
Normal file
2
resources/sql/autopatches/20140205.cal.1.rename.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_user.user_status
|
||||
RENAME {$NAMESPACE}_calendar.calendar_event;
|
|
@ -1262,6 +1262,9 @@ phutil_register_library_map(array(
|
|||
'PhabricatorCalendarDAO' => 'applications/calendar/storage/PhabricatorCalendarDAO.php',
|
||||
'PhabricatorCalendarDeleteStatusController' => 'applications/calendar/controller/PhabricatorCalendarDeleteStatusController.php',
|
||||
'PhabricatorCalendarEditStatusController' => 'applications/calendar/controller/PhabricatorCalendarEditStatusController.php',
|
||||
'PhabricatorCalendarEvent' => 'applications/calendar/storage/PhabricatorCalendarEvent.php',
|
||||
'PhabricatorCalendarEventInvalidEpochException' => 'applications/calendar/exception/PhabricatorCalendarEventInvalidEpochException.php',
|
||||
'PhabricatorCalendarEventOverlapException' => 'applications/calendar/exception/PhabricatorCalendarEventOverlapException.php',
|
||||
'PhabricatorCalendarHoliday' => 'applications/calendar/storage/PhabricatorCalendarHoliday.php',
|
||||
'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php',
|
||||
'PhabricatorCalendarViewStatusController' => 'applications/calendar/controller/PhabricatorCalendarViewStatusController.php',
|
||||
|
@ -2136,10 +2139,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorUserSSHKey' => 'applications/settings/storage/PhabricatorUserSSHKey.php',
|
||||
'PhabricatorUserSearchIndexer' => 'applications/people/search/PhabricatorUserSearchIndexer.php',
|
||||
'PhabricatorUserSinceField' => 'applications/people/customfield/PhabricatorUserSinceField.php',
|
||||
'PhabricatorUserStatus' => 'applications/people/storage/PhabricatorUserStatus.php',
|
||||
'PhabricatorUserStatusField' => 'applications/people/customfield/PhabricatorUserStatusField.php',
|
||||
'PhabricatorUserStatusInvalidEpochException' => 'applications/people/exception/PhabricatorUserStatusInvalidEpochException.php',
|
||||
'PhabricatorUserStatusOverlapException' => 'applications/people/exception/PhabricatorUserStatusOverlapException.php',
|
||||
'PhabricatorUserTestCase' => 'applications/people/storage/__tests__/PhabricatorUserTestCase.php',
|
||||
'PhabricatorUserTitleField' => 'applications/people/customfield/PhabricatorUserTitleField.php',
|
||||
'PhabricatorUserTransaction' => 'applications/people/storage/PhabricatorUserTransaction.php',
|
||||
|
@ -3900,6 +3900,9 @@ phutil_register_library_map(array(
|
|||
'PhabricatorCalendarDAO' => 'PhabricatorLiskDAO',
|
||||
'PhabricatorCalendarDeleteStatusController' => 'PhabricatorCalendarController',
|
||||
'PhabricatorCalendarEditStatusController' => 'PhabricatorCalendarController',
|
||||
'PhabricatorCalendarEvent' => 'PhabricatorCalendarDAO',
|
||||
'PhabricatorCalendarEventInvalidEpochException' => 'Exception',
|
||||
'PhabricatorCalendarEventOverlapException' => 'Exception',
|
||||
'PhabricatorCalendarHoliday' => 'PhabricatorCalendarDAO',
|
||||
'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorCalendarViewStatusController' => 'PhabricatorCalendarController',
|
||||
|
@ -4893,10 +4896,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorUserSSHKey' => 'PhabricatorUserDAO',
|
||||
'PhabricatorUserSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
||||
'PhabricatorUserSinceField' => 'PhabricatorUserCustomField',
|
||||
'PhabricatorUserStatus' => 'PhabricatorUserDAO',
|
||||
'PhabricatorUserStatusField' => 'PhabricatorUserCustomField',
|
||||
'PhabricatorUserStatusInvalidEpochException' => 'Exception',
|
||||
'PhabricatorUserStatusOverlapException' => 'Exception',
|
||||
'PhabricatorUserTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorUserTitleField' => 'PhabricatorUserCustomField',
|
||||
'PhabricatorUserTransaction' => 'PhabricatorApplicationTransaction',
|
||||
|
|
|
@ -19,7 +19,7 @@ final class PhabricatorCalendarBrowseController
|
|||
"{$year}-{$month}-01",
|
||||
"{$year}-{$month}-31");
|
||||
|
||||
$statuses = id(new PhabricatorUserStatus())
|
||||
$statuses = id(new PhabricatorCalendarEvent())
|
||||
->loadAllWhere(
|
||||
'dateTo >= %d AND dateFrom <= %d',
|
||||
strtotime("{$year}-{$month}-01"),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
abstract class PhabricatorCalendarController extends PhabricatorController {
|
||||
|
||||
|
||||
protected function buildSideNavView(PhabricatorUserStatus $status = null) {
|
||||
protected function buildSideNavView(PhabricatorCalendarEvent $status = null) {
|
||||
$nav = new AphrontSideNavFilterView();
|
||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ final class PhabricatorCalendarDeleteStatusController
|
|||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
$status = id(new PhabricatorUserStatus())
|
||||
$status = id(new PhabricatorCalendarEvent())
|
||||
->loadOneWhere('id = %d', $this->id);
|
||||
|
||||
if (!$status) {
|
||||
|
|
|
@ -30,7 +30,7 @@ final class PhabricatorCalendarEditStatusController
|
|||
->setInitialTime(AphrontFormDateControl::TIME_END_OF_DAY);
|
||||
|
||||
if ($this->isCreate()) {
|
||||
$status = new PhabricatorUserStatus();
|
||||
$status = new PhabricatorCalendarEvent();
|
||||
$end_value = $end_time->readValueFromRequest($request);
|
||||
$start_value = $start_time->readValueFromRequest($request);
|
||||
$submit_label = pht('Create');
|
||||
|
@ -38,7 +38,7 @@ final class PhabricatorCalendarEditStatusController
|
|||
$page_title = pht('Create Status');
|
||||
$redirect = 'created';
|
||||
} else {
|
||||
$status = id(new PhabricatorUserStatus())
|
||||
$status = id(new PhabricatorCalendarEvent())
|
||||
->loadOneWhere('id = %d', $this->id);
|
||||
$end_time->setValue($status->getDateTo());
|
||||
$start_time->setValue($status->getDateFrom());
|
||||
|
@ -67,9 +67,9 @@ final class PhabricatorCalendarEditStatusController
|
|||
->setDateTo($end_value)
|
||||
->setDescription($description)
|
||||
->save();
|
||||
} catch (PhabricatorUserStatusInvalidEpochException $e) {
|
||||
} catch (PhabricatorCalendarEventInvalidEpochException $e) {
|
||||
$errors[] = pht('Start must be before end.');
|
||||
} catch (PhabricatorUserStatusOverlapException $e) {
|
||||
} catch (PhabricatorCalendarEventOverlapException $e) {
|
||||
$errors[] = pht('There is already a status within the specified '.
|
||||
'timeframe. Edit or delete this existing status.');
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ final class PhabricatorCalendarViewStatusController
|
|||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
$handle = $this->getHandle($this->phid);
|
||||
$statuses = id(new PhabricatorUserStatus())
|
||||
$statuses = id(new PhabricatorCalendarEvent())
|
||||
->loadAllWhere('userPHID = %s AND dateTo > UNIX_TIMESTAMP()',
|
||||
$this->phid);
|
||||
|
||||
|
@ -43,7 +43,7 @@ final class PhabricatorCalendarViewStatusController
|
|||
}
|
||||
|
||||
private function buildStatusList(array $statuses) {
|
||||
assert_instances_of($statuses, 'PhabricatorUserStatus');
|
||||
assert_instances_of($statuses, 'PhabricatorCalendarEvent');
|
||||
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
|
@ -66,7 +66,7 @@ final class PhabricatorCalendarViewStatusController
|
|||
$from = phabricator_datetime($status->getDateFrom(), $user);
|
||||
$to = phabricator_datetime($status->getDateTo(), $user);
|
||||
|
||||
$color = ($status->getStatus() == PhabricatorUserStatus::STATUS_AWAY)
|
||||
$color = ($status->getStatus() == PhabricatorCalendarEvent::STATUS_AWAY)
|
||||
? 'red'
|
||||
: 'yellow';
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorCalendarEventInvalidEpochException extends Exception {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorCalendarEventOverlapException extends Exception {
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorUserStatus extends PhabricatorUserDAO {
|
||||
final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO {
|
||||
|
||||
protected $userPHID;
|
||||
protected $dateFrom;
|
||||
|
@ -34,7 +34,7 @@ final class PhabricatorUserStatus extends PhabricatorUserDAO {
|
|||
|
||||
public function getTerseSummary(PhabricatorUser $viewer) {
|
||||
$until = phabricator_date($this->dateTo, $viewer);
|
||||
if ($this->status == PhabricatorUserStatus::STATUS_SPORADIC) {
|
||||
if ($this->status == PhabricatorCalendarEvent::STATUS_SPORADIC) {
|
||||
return 'Sporadic until '.$until;
|
||||
} else {
|
||||
return 'Away until '.$until;
|
||||
|
@ -65,7 +65,7 @@ final class PhabricatorUserStatus extends PhabricatorUserDAO {
|
|||
public function save() {
|
||||
|
||||
if ($this->getDateTo() <= $this->getDateFrom()) {
|
||||
throw new PhabricatorUserStatusInvalidEpochException();
|
||||
throw new PhabricatorCalendarEventInvalidEpochException();
|
||||
}
|
||||
|
||||
$this->openTransaction();
|
||||
|
@ -82,7 +82,7 @@ final class PhabricatorUserStatus extends PhabricatorUserDAO {
|
|||
if ($overlap) {
|
||||
$this->endWriteLocking();
|
||||
$this->killTransaction();
|
||||
throw new PhabricatorUserStatusOverlapException();
|
||||
throw new PhabricatorCalendarEventOverlapException();
|
||||
}
|
||||
}
|
||||
|
|
@ -221,7 +221,7 @@ final class ConpherenceThreadQuery
|
|||
$this->getViewer());
|
||||
$start_epoch = $epochs['start_epoch'];
|
||||
$end_epoch = $epochs['end_epoch'];
|
||||
$statuses = id(new PhabricatorUserStatus())
|
||||
$statuses = id(new PhabricatorCalendarEvent())
|
||||
->loadAllWhere(
|
||||
'userPHID in (%Ls) AND dateTo >= %d AND dateFrom <= %d',
|
||||
$participant_phids,
|
||||
|
|
|
@ -12,7 +12,7 @@ abstract class ConduitAPI_user_Method extends ConduitAPIMethod {
|
|||
|
||||
protected function buildUserInformationDictionary(
|
||||
PhabricatorUser $user,
|
||||
PhabricatorUserStatus $current_status = null) {
|
||||
PhabricatorCalendarEvent $current_status = null) {
|
||||
|
||||
$roles = array();
|
||||
if ($user->getIsDisabled()) {
|
||||
|
|
|
@ -42,16 +42,16 @@ final class ConduitAPI_user_addstatus_Method extends ConduitAPI_user_Method {
|
|||
$description = $request->getValue('description', '');
|
||||
|
||||
try {
|
||||
id(new PhabricatorUserStatus())
|
||||
id(new PhabricatorCalendarEvent())
|
||||
->setUserPHID($user_phid)
|
||||
->setDateFrom($from)
|
||||
->setDateTo($to)
|
||||
->setTextStatus($status)
|
||||
->setDescription($description)
|
||||
->save();
|
||||
} catch (PhabricatorUserStatusInvalidEpochException $e) {
|
||||
} catch (PhabricatorCalendarEventInvalidEpochException $e) {
|
||||
throw new ConduitException('ERR-BAD-EPOCH');
|
||||
} catch (PhabricatorUserStatusOverlapException $e) {
|
||||
} catch (PhabricatorCalendarEventOverlapException $e) {
|
||||
throw new ConduitException('ERR-OVERLAP');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ final class ConduitAPI_user_query_Method
|
|||
}
|
||||
$users = $query->execute();
|
||||
|
||||
$statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses(
|
||||
$statuses = id(new PhabricatorCalendarEvent())->loadCurrentStatuses(
|
||||
mpull($users, 'getPHID'));
|
||||
|
||||
$results = array();
|
||||
|
|
|
@ -39,7 +39,7 @@ final class ConduitAPI_user_removestatus_Method extends ConduitAPI_user_Method {
|
|||
throw new ConduitException('ERR-BAD-EPOCH');
|
||||
}
|
||||
|
||||
$table = new PhabricatorUserStatus();
|
||||
$table = new PhabricatorCalendarEvent();
|
||||
$table->openTransaction();
|
||||
$table->beginReadLocking();
|
||||
|
||||
|
@ -52,7 +52,7 @@ final class ConduitAPI_user_removestatus_Method extends ConduitAPI_user_Method {
|
|||
if ($status->getDateFrom() < $from) {
|
||||
if ($status->getDateTo() > $to) {
|
||||
// Split the interval.
|
||||
id(new PhabricatorUserStatus())
|
||||
id(new PhabricatorCalendarEvent())
|
||||
->setUserPHID($user_phid)
|
||||
->setDateFrom($to)
|
||||
->setDateTo($status->getDateTo())
|
||||
|
|
|
@ -25,7 +25,7 @@ final class PhabricatorUserStatusField
|
|||
$user = $this->getObject();
|
||||
$viewer = $this->requireViewer();
|
||||
|
||||
$statuses = id(new PhabricatorUserStatus())
|
||||
$statuses = id(new PhabricatorCalendarEvent())
|
||||
->loadCurrentStatuses(array($user->getPHID()));
|
||||
if (!$statuses) {
|
||||
return pht('Available');
|
||||
|
|
|
@ -38,7 +38,7 @@ final class PhabricatorPeopleHovercardEventListener
|
|||
} else if (!$user->isUserActivated()) {
|
||||
$hovercard->addField(pht('Account'), pht('Not Activated'));
|
||||
} else {
|
||||
$statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses(
|
||||
$statuses = id(new PhabricatorCalendarEvent())->loadCurrentStatuses(
|
||||
array($user->getPHID()));
|
||||
if ($statuses) {
|
||||
$current_status = reset($statuses);
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorUserStatusInvalidEpochException extends Exception {
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorUserStatusOverlapException extends Exception {
|
||||
}
|
|
@ -167,7 +167,7 @@ final class PhabricatorPeopleQuery
|
|||
|
||||
if ($this->needStatus) {
|
||||
$user_list = mpull($users, null, 'getPHID');
|
||||
$statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses(
|
||||
$statuses = id(new PhabricatorCalendarEvent())->loadCurrentStatuses(
|
||||
array_keys($user_list));
|
||||
foreach ($user_list as $phid => $user) {
|
||||
$status = idx($statuses, $phid);
|
||||
|
|
|
@ -76,7 +76,7 @@ final class PhabricatorRemarkupRuleMention
|
|||
->execute();
|
||||
|
||||
if ($users) {
|
||||
$user_statuses = id(new PhabricatorUserStatus())
|
||||
$user_statuses = id(new PhabricatorCalendarEvent())
|
||||
->loadCurrentStatuses(mpull($users, 'getPHID'));
|
||||
$user_statuses = mpull($user_statuses, null, 'getUserPHID');
|
||||
} else {
|
||||
|
@ -113,9 +113,9 @@ final class PhabricatorRemarkupRuleMention
|
|||
$status = idx($user_statuses, $user->getPHID());
|
||||
if ($status) {
|
||||
$status = $status->getStatus();
|
||||
if ($status == PhabricatorUserStatus::STATUS_AWAY) {
|
||||
if ($status == PhabricatorCalendarEvent::STATUS_AWAY) {
|
||||
$tag->setDotColor(PHUITagView::COLOR_RED);
|
||||
} else if ($status == PhabricatorUserStatus::STATUS_AWAY) {
|
||||
} else if ($status == PhabricatorCalendarEvent::STATUS_AWAY) {
|
||||
$tag->setDotColor(PHUITagView::COLOR_ORANGE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -609,14 +609,13 @@ EOBODY;
|
|||
return celerity_get_resource_uri('/rsrc/image/avatar.png');
|
||||
}
|
||||
|
||||
public function attachStatus(PhabricatorUserStatus $status) {
|
||||
public function attachStatus(PhabricatorCalendarEvent $status) {
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStatus() {
|
||||
$this->assertAttached($this->status);
|
||||
return $this->status;
|
||||
return $this->assertAttached($this->status);
|
||||
}
|
||||
|
||||
public function hasStatus() {
|
||||
|
|
|
@ -775,7 +775,7 @@ abstract class LiskDAO {
|
|||
* row in retrieving other rows. Example of a correct usage:
|
||||
*
|
||||
* $status = $author->loadOneRelative(
|
||||
* new PhabricatorUserStatus(),
|
||||
* new PhabricatorCalendarEvent(),
|
||||
* 'userPHID',
|
||||
* 'getPHID',
|
||||
* '(UNIX_TIMESTAMP() BETWEEN dateFrom AND dateTo)');
|
||||
|
|
Loading…
Reference in a new issue