Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14087164
D16713.id40248.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
D16713.id40248.diff
View Options
diff --git a/src/applications/phriction/controller/PhrictionMoveController.php b/src/applications/phriction/controller/PhrictionMoveController.php
--- a/src/applications/phriction/controller/PhrictionMoveController.php
+++ b/src/applications/phriction/controller/PhrictionMoveController.php
@@ -66,9 +66,21 @@
$xactions[] = id(new PhrictionTransaction())
->setTransactionType(PhrictionTransaction::TYPE_MOVE_TO)
->setNewValue($document);
- $target_document = PhrictionDocument::initializeNewDocument(
- $viewer,
- $v_slug);
+ $target_document = id(new PhrictionDocumentQuery())
+ ->setViewer($viewer)
+ ->withSlugs(array(rtrim($normal_slug, '/').'/'))
+ ->needContent(true)
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->executeOne();
+ if (!$target_document) {
+ $target_document = PhrictionDocument::initializeNewDocument(
+ $viewer,
+ $v_slug);
+ }
try {
$editor->applyTransactions($target_document, $xactions);
$redir_uri = PhrictionDocument::getSlugURI(
diff --git a/src/applications/phriction/editor/PhrictionTransactionEditor.php b/src/applications/phriction/editor/PhrictionTransactionEditor.php
--- a/src/applications/phriction/editor/PhrictionTransactionEditor.php
+++ b/src/applications/phriction/editor/PhrictionTransactionEditor.php
@@ -588,6 +588,7 @@
// Prevent overwrites and no-op moves.
$exists = PhrictionDocumentStatus::STATUS_EXISTS;
if ($target_document) {
+ $message = null;
if ($target_document->getSlug() == $source_document->getSlug()) {
$message = pht(
'You can not move a document to its existing location. '.
@@ -598,13 +599,14 @@
'overwrite an existing document which is already at that '.
'location. Move or delete the existing document first.');
}
-
- $error = new PhabricatorApplicationTransactionValidationError(
- $type,
- pht('Invalid'),
- $message,
- $xaction);
- $errors[] = $error;
+ if ($message !== null) {
+ $error = new PhabricatorApplicationTransactionValidationError(
+ $type,
+ pht('Invalid'),
+ $message,
+ $xaction);
+ $errors[] = $error;
+ }
}
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 7:44 PM (20 h, 35 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6779734
Default Alt Text
D16713.id40248.diff (2 KB)
Attached To
Mode
D16713: Fix Phriction document move on to existing document placeholder
Attached
Detach File
Event Timeline
Log In to Comment