Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13973778
D9357.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9357.id.diff
View Options
diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php
--- a/src/applications/phriction/controller/PhrictionDocumentController.php
+++ b/src/applications/phriction/controller/PhrictionDocumentController.php
@@ -75,7 +75,6 @@
$vdate = phabricator_datetime($content->getDateCreated(), $user);
$version_note = new AphrontErrorView();
$version_note->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
- $version_note->setTitle('Older Version');
$version_note->appendChild(
pht('You are viewing an older version of this document, as it '.
'appeared on %s.', $vdate));
@@ -126,9 +125,8 @@
$slug_uri = PhrictionDocument::getSlugURI($new_doc->getSlug());
}
- $notice = new AphrontErrorView();
- $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
- $notice->setTitle(pht('Document Moved'));
+ $notice = id(new AphrontErrorView())
+ ->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
if ($slug_uri) {
$notice->appendChild(
@@ -159,22 +157,33 @@
$move_notice = null;
if ($current_status == PhrictionChangeType::CHANGE_MOVE_HERE) {
$from_doc_id = $content->getChangeRef();
- $from_doc = id(new PhrictionDocumentQuery())
+
+ $slug_uri = null;
+
+ // If the old document exists and is visible, provide a link to it.
+ $from_docs = id(new PhrictionDocumentQuery())
->setViewer($user)
->withIDs(array($from_doc_id))
- ->executeOne();
- $slug_uri = PhrictionDocument::getSlugURI($from_doc->getSlug());
+ ->execute();
+ if ($from_docs) {
+ $from_doc = head($from_docs);
+ $slug_uri = PhrictionDocument::getSlugURI($from_doc->getSlug());
+ }
$move_notice = id(new AphrontErrorView())
- ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
- ->appendChild(pht('This document was moved from %s',
- phutil_tag('a', array('href' => $slug_uri), $slug_uri)))
- ->render();
- }
- }
+ ->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
- if ($version_note) {
- $version_note = $version_note->render();
+ if ($slug_uri) {
+ $move_notice->appendChild(
+ pht(
+ 'This document was moved from %s.',
+ phutil_tag('a', array('href' => $slug_uri), $slug_uri)));
+ } else {
+ // Render this for consistency, even though it's a bit silly.
+ $move_notice->appendChild(
+ pht('This document was moved from elsewhere.'));
+ }
+ }
}
$children = $this->renderDocumentChildren($slug);
@@ -204,6 +213,7 @@
array(
$actions,
$prop_list,
+ $version_note,
$move_notice,
$core_content,
));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 19 2024, 2:35 AM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6729891
Default Alt Text
D9357.id.diff (2 KB)
Attached To
Mode
D9357: Fix an issues with moved Phriction documents if the old location does not exist or can't be loaded
Attached
Detach File
Event Timeline
Log In to Comment