diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1470,6 +1470,7 @@ 'PhabricatorConfigEntryQuery' => 'applications/config/query/PhabricatorConfigEntryQuery.php', 'PhabricatorConfigFileSource' => 'infrastructure/env/PhabricatorConfigFileSource.php', 'PhabricatorConfigGroupController' => 'applications/config/controller/PhabricatorConfigGroupController.php', + 'PhabricatorConfigHistoryController' => 'applications/config/controller/PhabricatorConfigHistoryController.php', 'PhabricatorConfigIgnoreController' => 'applications/config/controller/PhabricatorConfigIgnoreController.php', 'PhabricatorConfigIssueListController' => 'applications/config/controller/PhabricatorConfigIssueListController.php', 'PhabricatorConfigIssueViewController' => 'applications/config/controller/PhabricatorConfigIssueViewController.php', @@ -4618,6 +4619,7 @@ 'PhabricatorConfigEntryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorConfigFileSource' => 'PhabricatorConfigProxySource', 'PhabricatorConfigGroupController' => 'PhabricatorConfigController', + 'PhabricatorConfigHistoryController' => 'PhabricatorConfigController', 'PhabricatorConfigIgnoreController' => 'PhabricatorConfigController', 'PhabricatorConfigIssueListController' => 'PhabricatorConfigController', 'PhabricatorConfigIssueViewController' => 'PhabricatorConfigController', diff --git a/src/applications/config/application/PhabricatorConfigApplication.php b/src/applications/config/application/PhabricatorConfigApplication.php --- a/src/applications/config/application/PhabricatorConfigApplication.php +++ b/src/applications/config/application/PhabricatorConfigApplication.php @@ -39,6 +39,7 @@ '/config/' => array( '' => 'PhabricatorConfigListController', 'all/' => 'PhabricatorConfigAllController', + 'history/' => 'PhabricatorConfigHistoryController', 'edit/(?P[\w\.\-]+)/' => 'PhabricatorConfigEditController', 'group/(?P[^/]+)/' => 'PhabricatorConfigGroupController', 'welcome/' => 'PhabricatorConfigWelcomeController', diff --git a/src/applications/config/controller/PhabricatorConfigController.php b/src/applications/config/controller/PhabricatorConfigController.php --- a/src/applications/config/controller/PhabricatorConfigController.php +++ b/src/applications/config/controller/PhabricatorConfigController.php @@ -14,6 +14,7 @@ $nav->addLabel(pht('Configuration')); $nav->addFilter('/', pht('Browse Settings')); $nav->addFilter('all/', pht('All Settings')); + $nav->addFilter('history/', pht('Settings History')); $nav->addLabel(pht('Setup')); $nav->addFilter('issue/', pht('Setup Issues')); $nav->addLabel(pht('Database')); diff --git a/src/applications/config/controller/PhabricatorConfigHistoryController.php b/src/applications/config/controller/PhabricatorConfigHistoryController.php new file mode 100644 --- /dev/null +++ b/src/applications/config/controller/PhabricatorConfigHistoryController.php @@ -0,0 +1,53 @@ +getRequest(); + $user = $request->getUser(); + + $xactions = id(new PhabricatorConfigTransactionQuery()) + ->setViewer($user) + ->needComments(true) + ->setReversePaging(false) + ->execute(); + + foreach ($xactions as $action) { + $action->setDisplayKeys(true); + } + + $object = new PhabricatorConfigEntry(); + + $xaction = $object->getApplicationTransactionTemplate(); + + $view = $xaction->getApplicationTransactionViewObject(); + + $timeline = $view + ->setUser($user) + ->setTransactions($xactions) + ->setObjectPHID(PhabricatorPHIDConstants::PHID_VOID); + + $timeline->setShouldTerminate(true); + + $object->willRenderTimeline($timeline, $this->getRequest()); + + $title = pht('Settings History'); + + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb('Config', $this->getApplicationURI()); + + $crumbs->addTextCrumb($title, '/config/history/'); + + return $this->buildApplicationPage( + array( + $crumbs, + $timeline, + ), + array( + 'title' => $title, + )); + } + +} diff --git a/src/applications/config/storage/PhabricatorConfigTransaction.php b/src/applications/config/storage/PhabricatorConfigTransaction.php --- a/src/applications/config/storage/PhabricatorConfigTransaction.php +++ b/src/applications/config/storage/PhabricatorConfigTransaction.php @@ -3,6 +3,7 @@ final class PhabricatorConfigTransaction extends PhabricatorApplicationTransaction { + private $displayKeys = false; const TYPE_EDIT = 'config:edit'; public function getApplicationName() { @@ -17,6 +18,11 @@ return null; } + public function setDisplayKeys($display_keys = false) { + $this->displayKeys = $display_keys; + return $this; + } + public function getTitle() { $author_phid = $this->getAuthorPHID(); @@ -31,23 +37,48 @@ $old_del = idx($old, 'deleted'); $new_del = idx($new, 'deleted'); - if ($old_del && !$new_del) { - return pht( - '%s created this configuration entry.', - $this->renderHandleLink($author_phid)); - } else if (!$old_del && $new_del) { - return pht( - '%s deleted this configuration entry.', - $this->renderHandleLink($author_phid)); - } else if ($old_del && $new_del) { - // This is a bug. - return pht( - '%s deleted this configuration entry (again?).', - $this->renderHandleLink($author_phid)); + if ($this->displayKeys) { + if ($old_del && !$new_del) { + return pht( + '%s created %s.', + $this->renderHandleLink($author_phid), + $this->getObject()->getConfigKey()); + } else if (!$old_del && $new_del) { + return pht( + '%s deleted %s.', + $this->renderHandleLink($author_phid), + $this->getObject()->getConfigKey()); + } else if ($old_del && $new_del) { + // This is a bug. + return pht( + '%s deleted %s (again?).', + $this->renderHandleLink($author_phid), + $this->getObject()->getConfigKey()); + } else { + return pht( + '%s edited %s.', + $this->renderHandleLink($author_phid), + $this->getObject()->getConfigKey()); + } } else { - return pht( - '%s edited this configuration entry.', - $this->renderHandleLink($author_phid)); + if ($old_del && !$new_del) { + return pht( + '%s created this configuration entry.', + $this->renderHandleLink($author_phid)); + } else if (!$old_del && $new_del) { + return pht( + '%s deleted this configuration entry.', + $this->renderHandleLink($author_phid)); + } else if ($old_del && $new_del) { + // This is a bug. + return pht( + '%s deleted this configuration entry (again?).', + $this->renderHandleLink($author_phid)); + } else { + return pht( + '%s edited this configuration entry.', + $this->renderHandleLink($author_phid)); + } } break; }