Page MenuHomePhabricator

D11088.diff
No OneTemporary

D11088.diff

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
@@ -1479,6 +1479,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',
@@ -4641,6 +4642,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<key>[\w\.\-]+)/' => 'PhabricatorConfigEditController',
'group/(?P<key>[^/]+)/' => '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,50 @@
+<?php
+
+final class PhabricatorConfigHistoryController
+ extends PhabricatorConfigController {
+
+
+ public function processRequest() {
+ $request = $this->getRequest();
+ $user = $request->getUser();
+
+ $xactions = id(new PhabricatorConfigTransactionQuery())
+ ->setViewer($user)
+ ->needComments(true)
+ ->setReversePaging(false)
+ ->execute();
+
+ $object = new PhabricatorConfigEntry();
+
+ $xaction = $object->getApplicationTransactionTemplate();
+
+ $view = $xaction->getApplicationTransactionViewObject();
+
+ $timeline = $view
+ ->setUser($user)
+ ->setTransactions($xactions)
+ ->setRenderAsFeed(true)
+ ->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
@@ -55,6 +55,44 @@
return parent::getTitle();
}
+ public function getTitleForFeed(PhabricatorFeedStory $story = null) {
+ $author_phid = $this->getAuthorPHID();
+
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+
+ switch ($this->getTransactionType()) {
+ case self::TYPE_EDIT:
+ $old_del = idx($old, 'deleted');
+ $new_del = idx($new, 'deleted');
+ 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());
+ }
+ break;
+ }
+
+ return parent::getTitle();
+ }
+
public function getIcon() {
switch ($this->getTransactionType()) {
diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
--- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
+++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
@@ -14,8 +14,14 @@
private $quoteTargetID;
private $quoteRef;
private $pager;
+ private $renderAsFeed;
private $renderData = array();
+ public function setRenderAsFeed($feed) {
+ $this->renderAsFeed = $feed;
+ return $this;
+ }
+
public function setQuoteRef($quote_ref) {
$this->quoteRef = $quote_ref;
return $this;
@@ -390,7 +396,11 @@
}
if (!$this->shouldSuppressTitle($xaction, $group)) {
- $title = $xaction->getTitle();
+ if ($this->renderAsFeed) {
+ $title = $xaction->getTitleForFeed();
+ } else {
+ $title = $xaction->getTitle();
+ }
if ($xaction->hasChangeDetails()) {
if (!$this->isPreview) {
$details = $this->buildChangeDetailsLink($xaction);

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 25, 9:24 AM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6741381
Default Alt Text
D11088.diff (6 KB)

Event Timeline