@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.

Settings History

Summary:
Shows a timeline of all modified settings Fixes T6545
Will show all settings (no pagination, should be not so difficult to add if needed but most installs won't have hundreds of settings changes)
I'm not happy by how the PhabricatorConfigTransaction object is instructed to render the config keys but i don't see any other reasonable way.
We could always show the keys though.

Test Plan: Changed settings and called the history page

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6545

Differential Revision: https://secure.phabricator.com/D11088

authored by

Fabian Stelzer and committed by
epriestley
86eb7c0e 1ff6972f

+103 -1
+2
src/__phutil_library_map__.php
··· 1479 1479 'PhabricatorConfigEntryQuery' => 'applications/config/query/PhabricatorConfigEntryQuery.php', 1480 1480 'PhabricatorConfigFileSource' => 'infrastructure/env/PhabricatorConfigFileSource.php', 1481 1481 'PhabricatorConfigGroupController' => 'applications/config/controller/PhabricatorConfigGroupController.php', 1482 + 'PhabricatorConfigHistoryController' => 'applications/config/controller/PhabricatorConfigHistoryController.php', 1482 1483 'PhabricatorConfigIgnoreController' => 'applications/config/controller/PhabricatorConfigIgnoreController.php', 1483 1484 'PhabricatorConfigIssueListController' => 'applications/config/controller/PhabricatorConfigIssueListController.php', 1484 1485 'PhabricatorConfigIssueViewController' => 'applications/config/controller/PhabricatorConfigIssueViewController.php', ··· 4641 4642 'PhabricatorConfigEntryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 4642 4643 'PhabricatorConfigFileSource' => 'PhabricatorConfigProxySource', 4643 4644 'PhabricatorConfigGroupController' => 'PhabricatorConfigController', 4645 + 'PhabricatorConfigHistoryController' => 'PhabricatorConfigController', 4644 4646 'PhabricatorConfigIgnoreController' => 'PhabricatorConfigController', 4645 4647 'PhabricatorConfigIssueListController' => 'PhabricatorConfigController', 4646 4648 'PhabricatorConfigIssueViewController' => 'PhabricatorConfigController',
+1
src/applications/config/application/PhabricatorConfigApplication.php
··· 39 39 '/config/' => array( 40 40 '' => 'PhabricatorConfigListController', 41 41 'all/' => 'PhabricatorConfigAllController', 42 + 'history/' => 'PhabricatorConfigHistoryController', 42 43 'edit/(?P<key>[\w\.\-]+)/' => 'PhabricatorConfigEditController', 43 44 'group/(?P<key>[^/]+)/' => 'PhabricatorConfigGroupController', 44 45 'welcome/' => 'PhabricatorConfigWelcomeController',
+1
src/applications/config/controller/PhabricatorConfigController.php
··· 14 14 $nav->addLabel(pht('Configuration')); 15 15 $nav->addFilter('/', pht('Browse Settings')); 16 16 $nav->addFilter('all/', pht('All Settings')); 17 + $nav->addFilter('history/', pht('Settings History')); 17 18 $nav->addLabel(pht('Setup')); 18 19 $nav->addFilter('issue/', pht('Setup Issues')); 19 20 $nav->addLabel(pht('Database'));
+50
src/applications/config/controller/PhabricatorConfigHistoryController.php
··· 1 + <?php 2 + 3 + final class PhabricatorConfigHistoryController 4 + extends PhabricatorConfigController { 5 + 6 + 7 + public function processRequest() { 8 + $request = $this->getRequest(); 9 + $user = $request->getUser(); 10 + 11 + $xactions = id(new PhabricatorConfigTransactionQuery()) 12 + ->setViewer($user) 13 + ->needComments(true) 14 + ->setReversePaging(false) 15 + ->execute(); 16 + 17 + $object = new PhabricatorConfigEntry(); 18 + 19 + $xaction = $object->getApplicationTransactionTemplate(); 20 + 21 + $view = $xaction->getApplicationTransactionViewObject(); 22 + 23 + $timeline = $view 24 + ->setUser($user) 25 + ->setTransactions($xactions) 26 + ->setRenderAsFeed(true) 27 + ->setObjectPHID(PhabricatorPHIDConstants::PHID_VOID); 28 + 29 + $timeline->setShouldTerminate(true); 30 + 31 + $object->willRenderTimeline($timeline, $this->getRequest()); 32 + 33 + $title = pht('Settings History'); 34 + 35 + $crumbs = $this->buildApplicationCrumbs(); 36 + $crumbs->addTextCrumb('Config', $this->getApplicationURI()); 37 + 38 + $crumbs->addTextCrumb($title, '/config/history/'); 39 + 40 + return $this->buildApplicationPage( 41 + array( 42 + $crumbs, 43 + $timeline, 44 + ), 45 + array( 46 + 'title' => $title, 47 + )); 48 + } 49 + 50 + }
+38
src/applications/config/storage/PhabricatorConfigTransaction.php
··· 55 55 return parent::getTitle(); 56 56 } 57 57 58 + public function getTitleForFeed(PhabricatorFeedStory $story = null) { 59 + $author_phid = $this->getAuthorPHID(); 60 + 61 + $old = $this->getOldValue(); 62 + $new = $this->getNewValue(); 63 + 64 + switch ($this->getTransactionType()) { 65 + case self::TYPE_EDIT: 66 + $old_del = idx($old, 'deleted'); 67 + $new_del = idx($new, 'deleted'); 68 + if ($old_del && !$new_del) { 69 + return pht( 70 + '%s created %s.', 71 + $this->renderHandleLink($author_phid), 72 + $this->getObject()->getConfigKey()); 73 + } else if (!$old_del && $new_del) { 74 + return pht( 75 + '%s deleted %s.', 76 + $this->renderHandleLink($author_phid), 77 + $this->getObject()->getConfigKey()); 78 + } else if ($old_del && $new_del) { 79 + // This is a bug. 80 + return pht( 81 + '%s deleted %s (again?).', 82 + $this->renderHandleLink($author_phid), 83 + $this->getObject()->getConfigKey()); 84 + } else { 85 + return pht( 86 + '%s edited %s.', 87 + $this->renderHandleLink($author_phid), 88 + $this->getObject()->getConfigKey()); 89 + } 90 + break; 91 + } 92 + 93 + return parent::getTitle(); 94 + } 95 + 58 96 59 97 public function getIcon() { 60 98 switch ($this->getTransactionType()) {
+11 -1
src/applications/transactions/view/PhabricatorApplicationTransactionView.php
··· 14 14 private $quoteTargetID; 15 15 private $quoteRef; 16 16 private $pager; 17 + private $renderAsFeed; 17 18 private $renderData = array(); 19 + 20 + public function setRenderAsFeed($feed) { 21 + $this->renderAsFeed = $feed; 22 + return $this; 23 + } 18 24 19 25 public function setQuoteRef($quote_ref) { 20 26 $this->quoteRef = $quote_ref; ··· 390 396 } 391 397 392 398 if (!$this->shouldSuppressTitle($xaction, $group)) { 393 - $title = $xaction->getTitle(); 399 + if ($this->renderAsFeed) { 400 + $title = $xaction->getTitleForFeed(); 401 + } else { 402 + $title = $xaction->getTitle(); 403 + } 394 404 if ($xaction->hasChangeDetails()) { 395 405 if (!$this->isPreview) { 396 406 $details = $this->buildChangeDetailsLink($xaction);