Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15395709
D9254.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
D9254.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
@@ -112,20 +112,45 @@
$core_content = $notice->render();
} else if ($current_status == PhrictionChangeType::CHANGE_MOVE_AWAY) {
$new_doc_id = $content->getChangeRef();
- $new_doc = id(new PhrictionDocumentQuery())
+
+ $slug_uri = null;
+
+ // If the new document exists and the viewer can see it, provide a link
+ // to it. Otherwise, render a generic message.
+ $new_docs = id(new PhrictionDocumentQuery())
->setViewer($user)
->withIDs(array($new_doc_id))
- ->executeOne();
-
- $slug_uri = PhrictionDocument::getSlugURI($new_doc->getSlug());
+ ->execute();
+ if ($new_docs) {
+ $new_doc = head($new_docs);
+ $slug_uri = PhrictionDocument::getSlugURI($new_doc->getSlug());
+ }
$notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle(pht('Document Moved'));
- $notice->appendChild(phutil_tag('p', array(),
- pht('This document has been moved to %s. You can edit it to put new '.
- 'content here, or use history to revert to an earlier version.',
- phutil_tag('a', array('href' => $slug_uri), $slug_uri))));
+
+ if ($slug_uri) {
+ $notice->appendChild(
+ phutil_tag(
+ 'p',
+ array(),
+ pht(
+ 'This document has been moved to %s. You can edit it to put '.
+ 'new content here, or use history to revert to an earlier '.
+ 'version.',
+ phutil_tag('a', array('href' => $slug_uri), $slug_uri))));
+ } else {
+ $notice->appendChild(
+ phutil_tag(
+ 'p',
+ array(),
+ pht(
+ 'This document has been moved. You can edit it to put new '.
+ 'contne here, or use history to revert to an earlier '.
+ 'version.')));
+ }
+
$core_content = $notice->render();
} else {
throw new Exception("Unknown document status '{$doc_status}'!");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 17, 9:08 AM (5 d, 18 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7387240
Default Alt Text
D9254.diff (2 KB)
Attached To
Mode
D9254: Don't fatal when viewing a moved document if the target does not exist or isn't visible
Attached
Detach File
Event Timeline
Log In to Comment