1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 20:40:56 +01:00

Fix project editing issue with moving wikis

Summary: Fixes T4409. I didn't get this quite right when I updated it to ApplicationTransactions.

Test Plan: Renamed a project, saw wiki move.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4409

Differential Revision: https://secure.phabricator.com/D8198
This commit is contained in:
epriestley 2014-02-11 11:30:38 -08:00
parent 8739ea4dc1
commit 3a01d6dae5

View file

@ -55,6 +55,7 @@ final class PhabricatorProjectTransactionEditor
switch ($xaction->getTransactionType()) {
case PhabricatorProjectTransaction::TYPE_NAME:
$object->setName($xaction->getNewValue());
$object->setPhrictionSlug($xaction->getNewValue());
return;
case PhabricatorProjectTransaction::TYPE_STATUS:
$object->setStatus($xaction->getNewValue());
@ -84,14 +85,17 @@ final class PhabricatorProjectTransactionEditor
switch ($xaction->getTransactionType()) {
case PhabricatorProjectTransaction::TYPE_NAME:
$old_slug = $object->getFullPhrictionSlug();
$object->setPhrictionSlug($xaction->getNewValue());
$changed_slug = $old_slug != $object->getFullPhrictionSlug();
if ($xaction->getOldValue() && $changed_slug) {
if ($xaction->getOldValue() === null) {
// Project was just created, we don't need to move anything.
return;
}
$clone_object = clone $object;
$clone_object->setPhrictionSlug($xaction->getOldValue());
$old_slug = $clone_object->getFullPhrictionSlug();
$old_document = id(new PhrictionDocument())
->loadOneWhere(
'slug = %s',
$old_slug);
->loadOneWhere('slug = %s', $old_slug);
if ($old_document && $old_document->getStatus() ==
PhrictionDocumentStatus::STATUS_EXISTS) {
$content = id(new PhrictionContent())
@ -113,7 +117,6 @@ final class PhabricatorProjectTransactionEditor
$target_document = $target_editor->getDocument();
$from_editor->moveAway($target_document->getID());
}
}
return;
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: