@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+47 -46
+2
resources/sql/autopatches/20140205.cal.1.rename.sql
··· 1 + ALTER TABLE {$NAMESPACE}_user.user_status 2 + RENAME {$NAMESPACE}_calendar.calendar_event;
+6 -6
src/__phutil_library_map__.php
··· 1262 1262 'PhabricatorCalendarDAO' => 'applications/calendar/storage/PhabricatorCalendarDAO.php', 1263 1263 'PhabricatorCalendarDeleteStatusController' => 'applications/calendar/controller/PhabricatorCalendarDeleteStatusController.php', 1264 1264 'PhabricatorCalendarEditStatusController' => 'applications/calendar/controller/PhabricatorCalendarEditStatusController.php', 1265 + 'PhabricatorCalendarEvent' => 'applications/calendar/storage/PhabricatorCalendarEvent.php', 1266 + 'PhabricatorCalendarEventInvalidEpochException' => 'applications/calendar/exception/PhabricatorCalendarEventInvalidEpochException.php', 1267 + 'PhabricatorCalendarEventOverlapException' => 'applications/calendar/exception/PhabricatorCalendarEventOverlapException.php', 1265 1268 'PhabricatorCalendarHoliday' => 'applications/calendar/storage/PhabricatorCalendarHoliday.php', 1266 1269 'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php', 1267 1270 'PhabricatorCalendarViewStatusController' => 'applications/calendar/controller/PhabricatorCalendarViewStatusController.php', ··· 2136 2139 'PhabricatorUserSSHKey' => 'applications/settings/storage/PhabricatorUserSSHKey.php', 2137 2140 'PhabricatorUserSearchIndexer' => 'applications/people/search/PhabricatorUserSearchIndexer.php', 2138 2141 'PhabricatorUserSinceField' => 'applications/people/customfield/PhabricatorUserSinceField.php', 2139 - 'PhabricatorUserStatus' => 'applications/people/storage/PhabricatorUserStatus.php', 2140 2142 'PhabricatorUserStatusField' => 'applications/people/customfield/PhabricatorUserStatusField.php', 2141 - 'PhabricatorUserStatusInvalidEpochException' => 'applications/people/exception/PhabricatorUserStatusInvalidEpochException.php', 2142 - 'PhabricatorUserStatusOverlapException' => 'applications/people/exception/PhabricatorUserStatusOverlapException.php', 2143 2143 'PhabricatorUserTestCase' => 'applications/people/storage/__tests__/PhabricatorUserTestCase.php', 2144 2144 'PhabricatorUserTitleField' => 'applications/people/customfield/PhabricatorUserTitleField.php', 2145 2145 'PhabricatorUserTransaction' => 'applications/people/storage/PhabricatorUserTransaction.php', ··· 3900 3900 'PhabricatorCalendarDAO' => 'PhabricatorLiskDAO', 3901 3901 'PhabricatorCalendarDeleteStatusController' => 'PhabricatorCalendarController', 3902 3902 'PhabricatorCalendarEditStatusController' => 'PhabricatorCalendarController', 3903 + 'PhabricatorCalendarEvent' => 'PhabricatorCalendarDAO', 3904 + 'PhabricatorCalendarEventInvalidEpochException' => 'Exception', 3905 + 'PhabricatorCalendarEventOverlapException' => 'Exception', 3903 3906 'PhabricatorCalendarHoliday' => 'PhabricatorCalendarDAO', 3904 3907 'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase', 3905 3908 'PhabricatorCalendarViewStatusController' => 'PhabricatorCalendarController', ··· 4893 4896 'PhabricatorUserSSHKey' => 'PhabricatorUserDAO', 4894 4897 'PhabricatorUserSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 4895 4898 'PhabricatorUserSinceField' => 'PhabricatorUserCustomField', 4896 - 'PhabricatorUserStatus' => 'PhabricatorUserDAO', 4897 4899 'PhabricatorUserStatusField' => 'PhabricatorUserCustomField', 4898 - 'PhabricatorUserStatusInvalidEpochException' => 'Exception', 4899 - 'PhabricatorUserStatusOverlapException' => 'Exception', 4900 4900 'PhabricatorUserTestCase' => 'PhabricatorTestCase', 4901 4901 'PhabricatorUserTitleField' => 'PhabricatorUserCustomField', 4902 4902 'PhabricatorUserTransaction' => 'PhabricatorApplicationTransaction',
+1 -1
src/applications/calendar/controller/PhabricatorCalendarBrowseController.php
··· 19 19 "{$year}-{$month}-01", 20 20 "{$year}-{$month}-31"); 21 21 22 - $statuses = id(new PhabricatorUserStatus()) 22 + $statuses = id(new PhabricatorCalendarEvent()) 23 23 ->loadAllWhere( 24 24 'dateTo >= %d AND dateFrom <= %d', 25 25 strtotime("{$year}-{$month}-01"),
+1 -1
src/applications/calendar/controller/PhabricatorCalendarController.php
··· 3 3 abstract class PhabricatorCalendarController extends PhabricatorController { 4 4 5 5 6 - protected function buildSideNavView(PhabricatorUserStatus $status = null) { 6 + protected function buildSideNavView(PhabricatorCalendarEvent $status = null) { 7 7 $nav = new AphrontSideNavFilterView(); 8 8 $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 9 9
+1 -1
src/applications/calendar/controller/PhabricatorCalendarDeleteStatusController.php
··· 12 12 public function processRequest() { 13 13 $request = $this->getRequest(); 14 14 $user = $request->getUser(); 15 - $status = id(new PhabricatorUserStatus()) 15 + $status = id(new PhabricatorCalendarEvent()) 16 16 ->loadOneWhere('id = %d', $this->id); 17 17 18 18 if (!$status) {
+4 -4
src/applications/calendar/controller/PhabricatorCalendarEditStatusController.php
··· 30 30 ->setInitialTime(AphrontFormDateControl::TIME_END_OF_DAY); 31 31 32 32 if ($this->isCreate()) { 33 - $status = new PhabricatorUserStatus(); 33 + $status = new PhabricatorCalendarEvent(); 34 34 $end_value = $end_time->readValueFromRequest($request); 35 35 $start_value = $start_time->readValueFromRequest($request); 36 36 $submit_label = pht('Create'); ··· 38 38 $page_title = pht('Create Status'); 39 39 $redirect = 'created'; 40 40 } else { 41 - $status = id(new PhabricatorUserStatus()) 41 + $status = id(new PhabricatorCalendarEvent()) 42 42 ->loadOneWhere('id = %d', $this->id); 43 43 $end_time->setValue($status->getDateTo()); 44 44 $start_time->setValue($status->getDateFrom()); ··· 67 67 ->setDateTo($end_value) 68 68 ->setDescription($description) 69 69 ->save(); 70 - } catch (PhabricatorUserStatusInvalidEpochException $e) { 70 + } catch (PhabricatorCalendarEventInvalidEpochException $e) { 71 71 $errors[] = pht('Start must be before end.'); 72 - } catch (PhabricatorUserStatusOverlapException $e) { 72 + } catch (PhabricatorCalendarEventOverlapException $e) { 73 73 $errors[] = pht('There is already a status within the specified '. 74 74 'timeframe. Edit or delete this existing status.'); 75 75 }
+3 -3
src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php
··· 16 16 $request = $this->getRequest(); 17 17 $user = $request->getUser(); 18 18 $handle = $this->getHandle($this->phid); 19 - $statuses = id(new PhabricatorUserStatus()) 19 + $statuses = id(new PhabricatorCalendarEvent()) 20 20 ->loadAllWhere('userPHID = %s AND dateTo > UNIX_TIMESTAMP()', 21 21 $this->phid); 22 22 ··· 43 43 } 44 44 45 45 private function buildStatusList(array $statuses) { 46 - assert_instances_of($statuses, 'PhabricatorUserStatus'); 46 + assert_instances_of($statuses, 'PhabricatorCalendarEvent'); 47 47 48 48 $user = $this->getRequest()->getUser(); 49 49 ··· 66 66 $from = phabricator_datetime($status->getDateFrom(), $user); 67 67 $to = phabricator_datetime($status->getDateTo(), $user); 68 68 69 - $color = ($status->getStatus() == PhabricatorUserStatus::STATUS_AWAY) 69 + $color = ($status->getStatus() == PhabricatorCalendarEvent::STATUS_AWAY) 70 70 ? 'red' 71 71 : 'yellow'; 72 72
+4
src/applications/calendar/exception/PhabricatorCalendarEventInvalidEpochException.php
··· 1 + <?php 2 + 3 + final class PhabricatorCalendarEventInvalidEpochException extends Exception { 4 + }
+4
src/applications/calendar/exception/PhabricatorCalendarEventOverlapException.php
··· 1 + <?php 2 + 3 + final class PhabricatorCalendarEventOverlapException extends Exception { 4 + }
+1 -1
src/applications/conpherence/query/ConpherenceThreadQuery.php
··· 221 221 $this->getViewer()); 222 222 $start_epoch = $epochs['start_epoch']; 223 223 $end_epoch = $epochs['end_epoch']; 224 - $statuses = id(new PhabricatorUserStatus()) 224 + $statuses = id(new PhabricatorCalendarEvent()) 225 225 ->loadAllWhere( 226 226 'userPHID in (%Ls) AND dateTo >= %d AND dateFrom <= %d', 227 227 $participant_phids,
+1 -1
src/applications/people/conduit/ConduitAPI_user_Method.php
··· 12 12 13 13 protected function buildUserInformationDictionary( 14 14 PhabricatorUser $user, 15 - PhabricatorUserStatus $current_status = null) { 15 + PhabricatorCalendarEvent $current_status = null) { 16 16 17 17 $roles = array(); 18 18 if ($user->getIsDisabled()) {
+3 -3
src/applications/people/conduit/ConduitAPI_user_addstatus_Method.php
··· 42 42 $description = $request->getValue('description', ''); 43 43 44 44 try { 45 - id(new PhabricatorUserStatus()) 45 + id(new PhabricatorCalendarEvent()) 46 46 ->setUserPHID($user_phid) 47 47 ->setDateFrom($from) 48 48 ->setDateTo($to) 49 49 ->setTextStatus($status) 50 50 ->setDescription($description) 51 51 ->save(); 52 - } catch (PhabricatorUserStatusInvalidEpochException $e) { 52 + } catch (PhabricatorCalendarEventInvalidEpochException $e) { 53 53 throw new ConduitException('ERR-BAD-EPOCH'); 54 - } catch (PhabricatorUserStatusOverlapException $e) { 54 + } catch (PhabricatorCalendarEventOverlapException $e) { 55 55 throw new ConduitException('ERR-OVERLAP'); 56 56 } 57 57 }
+1 -1
src/applications/people/conduit/ConduitAPI_user_query_Method.php
··· 69 69 } 70 70 $users = $query->execute(); 71 71 72 - $statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses( 72 + $statuses = id(new PhabricatorCalendarEvent())->loadCurrentStatuses( 73 73 mpull($users, 'getPHID')); 74 74 75 75 $results = array();
+2 -2
src/applications/people/conduit/ConduitAPI_user_removestatus_Method.php
··· 39 39 throw new ConduitException('ERR-BAD-EPOCH'); 40 40 } 41 41 42 - $table = new PhabricatorUserStatus(); 42 + $table = new PhabricatorCalendarEvent(); 43 43 $table->openTransaction(); 44 44 $table->beginReadLocking(); 45 45 ··· 52 52 if ($status->getDateFrom() < $from) { 53 53 if ($status->getDateTo() > $to) { 54 54 // Split the interval. 55 - id(new PhabricatorUserStatus()) 55 + id(new PhabricatorCalendarEvent()) 56 56 ->setUserPHID($user_phid) 57 57 ->setDateFrom($to) 58 58 ->setDateTo($status->getDateTo())
+1 -1
src/applications/people/customfield/PhabricatorUserStatusField.php
··· 25 25 $user = $this->getObject(); 26 26 $viewer = $this->requireViewer(); 27 27 28 - $statuses = id(new PhabricatorUserStatus()) 28 + $statuses = id(new PhabricatorCalendarEvent()) 29 29 ->loadCurrentStatuses(array($user->getPHID())); 30 30 if (!$statuses) { 31 31 return pht('Available');
+1 -1
src/applications/people/event/PhabricatorPeopleHovercardEventListener.php
··· 38 38 } else if (!$user->isUserActivated()) { 39 39 $hovercard->addField(pht('Account'), pht('Not Activated')); 40 40 } else { 41 - $statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses( 41 + $statuses = id(new PhabricatorCalendarEvent())->loadCurrentStatuses( 42 42 array($user->getPHID())); 43 43 if ($statuses) { 44 44 $current_status = reset($statuses);
-4
src/applications/people/exception/PhabricatorUserStatusInvalidEpochException.php
··· 1 - <?php 2 - 3 - final class PhabricatorUserStatusInvalidEpochException extends Exception { 4 - }
-4
src/applications/people/exception/PhabricatorUserStatusOverlapException.php
··· 1 - <?php 2 - 3 - final class PhabricatorUserStatusOverlapException extends Exception { 4 - }
+1 -1
src/applications/people/query/PhabricatorPeopleQuery.php
··· 167 167 168 168 if ($this->needStatus) { 169 169 $user_list = mpull($users, null, 'getPHID'); 170 - $statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses( 170 + $statuses = id(new PhabricatorCalendarEvent())->loadCurrentStatuses( 171 171 array_keys($user_list)); 172 172 foreach ($user_list as $phid => $user) { 173 173 $status = idx($statuses, $phid);
+3 -3
src/applications/people/remarkup/PhabricatorRemarkupRuleMention.php
··· 76 76 ->execute(); 77 77 78 78 if ($users) { 79 - $user_statuses = id(new PhabricatorUserStatus()) 79 + $user_statuses = id(new PhabricatorCalendarEvent()) 80 80 ->loadCurrentStatuses(mpull($users, 'getPHID')); 81 81 $user_statuses = mpull($user_statuses, null, 'getUserPHID'); 82 82 } else { ··· 113 113 $status = idx($user_statuses, $user->getPHID()); 114 114 if ($status) { 115 115 $status = $status->getStatus(); 116 - if ($status == PhabricatorUserStatus::STATUS_AWAY) { 116 + if ($status == PhabricatorCalendarEvent::STATUS_AWAY) { 117 117 $tag->setDotColor(PHUITagView::COLOR_RED); 118 - } else if ($status == PhabricatorUserStatus::STATUS_AWAY) { 118 + } else if ($status == PhabricatorCalendarEvent::STATUS_AWAY) { 119 119 $tag->setDotColor(PHUITagView::COLOR_ORANGE); 120 120 } 121 121 }
+2 -3
src/applications/people/storage/PhabricatorUser.php
··· 609 609 return celerity_get_resource_uri('/rsrc/image/avatar.png'); 610 610 } 611 611 612 - public function attachStatus(PhabricatorUserStatus $status) { 612 + public function attachStatus(PhabricatorCalendarEvent $status) { 613 613 $this->status = $status; 614 614 return $this; 615 615 } 616 616 617 617 public function getStatus() { 618 - $this->assertAttached($this->status); 619 - return $this->status; 618 + return $this->assertAttached($this->status); 620 619 } 621 620 622 621 public function hasStatus() {
+4 -4
src/applications/people/storage/PhabricatorUserStatus.php src/applications/calendar/storage/PhabricatorCalendarEvent.php
··· 1 1 <?php 2 2 3 - final class PhabricatorUserStatus extends PhabricatorUserDAO { 3 + final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO { 4 4 5 5 protected $userPHID; 6 6 protected $dateFrom; ··· 34 34 35 35 public function getTerseSummary(PhabricatorUser $viewer) { 36 36 $until = phabricator_date($this->dateTo, $viewer); 37 - if ($this->status == PhabricatorUserStatus::STATUS_SPORADIC) { 37 + if ($this->status == PhabricatorCalendarEvent::STATUS_SPORADIC) { 38 38 return 'Sporadic until '.$until; 39 39 } else { 40 40 return 'Away until '.$until; ··· 65 65 public function save() { 66 66 67 67 if ($this->getDateTo() <= $this->getDateFrom()) { 68 - throw new PhabricatorUserStatusInvalidEpochException(); 68 + throw new PhabricatorCalendarEventInvalidEpochException(); 69 69 } 70 70 71 71 $this->openTransaction(); ··· 82 82 if ($overlap) { 83 83 $this->endWriteLocking(); 84 84 $this->killTransaction(); 85 - throw new PhabricatorUserStatusOverlapException(); 85 + throw new PhabricatorCalendarEventOverlapException(); 86 86 } 87 87 } 88 88
+1 -1
src/infrastructure/storage/lisk/LiskDAO.php
··· 775 775 * row in retrieving other rows. Example of a correct usage: 776 776 * 777 777 * $status = $author->loadOneRelative( 778 - * new PhabricatorUserStatus(), 778 + * new PhabricatorCalendarEvent(), 779 779 * 'userPHID', 780 780 * 'getPHID', 781 781 * '(UNIX_TIMESTAMP() BETWEEN dateFrom AND dateTo)');