From 0abf29765e058cb410a98d5d0db8c434b9df096b Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 13 Sep 2018 08:13:41 -0700 Subject: [PATCH] Make Phriction diff-of-changes view draft-aware and clarify some language Summary: Ref T13077. Ref T13197. See PHI840. - In the "History > Diff/Compare" view, the button language wasn't draft-aware. - Revise language to avoid the word "Revert", since this can be ambiguous. - "Edit this page, starting with an older version of the text" is now "Edit Older|Current|Draft Version X". - "Mark this older version of the page as the current published version" is now "Publish Older Version". - Let the user edit the current published version, too, since this is a reasonable operation if there are drafts. Test Plan: Navigated the history diff view, saw better button and action text. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13197, T13077 Differential Revision: https://secure.phabricator.com/D19668 --- .../controller/PhrictionDiffController.php | 20 +++++++++---------- .../PhrictionDocumentController.php | 2 +- .../controller/PhrictionPublishController.php | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/applications/phriction/controller/PhrictionDiffController.php b/src/applications/phriction/controller/PhrictionDiffController.php index c81a90a3df..537f743eba 100644 --- a/src/applications/phriction/controller/PhrictionDiffController.php +++ b/src/applications/phriction/controller/PhrictionDiffController.php @@ -95,7 +95,7 @@ final class PhrictionDiffController extends PhrictionController { $navigation_table = null; if ($l + 1 == $r) { $nav_l = ($l > 1); - $nav_r = ($r != $current->getVersion()); + $nav_r = ($r != $document->getMaxVersion()); $uri = $request->getRequestURI(); @@ -191,30 +191,28 @@ final class PhrictionDiffController extends PhrictionController { PhrictionChangeType::CHANGE_MOVE_AWAY => true, // Plain silly PhrictionChangeType::CHANGE_STUB => true, // Utterly silly ); + if (isset($hidden_statuses[$content->getChangeType()])) { // Don't show an edit/revert button for changes which deleted, moved or // stubbed the content since it's silly. return null; } - if ($content->getID() == $current->getID()) { - return phutil_tag( - 'a', - array( - 'href' => '/phriction/edit/'.$document_id.'/', - 'class' => 'button button-grey', - ), - pht('Edit Current Version')); + if ($version == $current->getVersion()) { + $label = pht('Edit Current Version %s...', new PhutilNumber($version)); + } else if ($version < $current->getVersion()) { + $label = pht('Edit Older Version %s...', new PhutilNumber($version)); + } else { + $label = pht('Edit Draft Version %s...', new PhutilNumber($version)); } - return phutil_tag( 'a', array( 'href' => '/phriction/edit/'.$document_id.'/?revert='.$version, 'class' => 'button button-grey', ), - pht('Revert to Version %s...', $version)); + $label); } private function renderComparisonTable(array $content) { diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index 1853dd1ee1..77f6a3529c 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -476,7 +476,7 @@ final class PhrictionDocumentController if ($is_draft) { $publish_name = pht('Publish Draft'); } else { - $publish_name = pht('Publish Revert'); + $publish_name = pht('Publish Older Version'); } // If you're looking at the current version; and it's an unpublished diff --git a/src/applications/phriction/controller/PhrictionPublishController.php b/src/applications/phriction/controller/PhrictionPublishController.php index 43c90cb1fa..e24b5f9be0 100644 --- a/src/applications/phriction/controller/PhrictionPublishController.php +++ b/src/applications/phriction/controller/PhrictionPublishController.php @@ -63,7 +63,7 @@ final class PhrictionPublishController } if ($content->getVersion() < $document->getContent()->getVersion()) { - $title = pht('Revert Document?'); + $title = pht('Publish Older Version?'); $body = pht( 'Revert the published version of this document to an older '. 'version?'); -- 2.51.2