1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Reg. D5201 - inlines and overwrites

Test Plan: not yet

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2208

Differential Revision: https://secure.phabricator.com/D5205
This commit is contained in:
Anh Nhan Nguyen 2013-03-04 08:51:10 -08:00 committed by epriestley
parent 6b0138c1ae
commit 88bf053ece
2 changed files with 7 additions and 6 deletions

View file

@ -9,7 +9,7 @@ final class PhrictionChangeType extends PhrictionConstants {
const CHANGE_DELETE = 1;
const CHANGE_MOVE_HERE = 2;
const CHANGE_MOVE_AWAY = 3;
const CHANGE_PARENT = 4;
const CHANGE_STUB = 4;
public static function getChangeTypeLabel($const) {
static $map = array(
@ -17,7 +17,7 @@ final class PhrictionChangeType extends PhrictionConstants {
self::CHANGE_DELETE => 'Delete',
self::CHANGE_MOVE_HERE => 'Move Here',
self::CHANGE_MOVE_AWAY => 'Move Away',
self::CHANGE_PARENT => 'Created through child',
self::CHANGE_STUB => 'Created through child',
);
return idx($map, $const, '???');

View file

@ -83,13 +83,13 @@ final class PhrictionDocumentEditor extends PhabricatorEditor {
return $this->updateDocument($document, $content, $new_content);
}
public function stub() {
private function stub() {
$actor = $this->requireActor();
$document = $this->document;
$content = $this->content;
$new_content = $this->buildContentTemplate($document, $content);
$new_content->setChangeType(PhrictionChangeType::CHANGE_PARENT);
$new_content->setChangeType(PhrictionChangeType::CHANGE_STUB);
$new_content->setContent('');
return $this->updateDocument($document, $content, $new_content);
@ -164,7 +164,7 @@ final class PhrictionDocumentEditor extends PhabricatorEditor {
"You can not delete a document which doesn't exist yet!");
}
break;
case PhrictionChangeType::CHANGE_PARENT:
case PhrictionChangeType::CHANGE_STUB:
$doc_status = PhrictionDocumentStatus::STATUS_STUB;
$feed_action = null;
break;
@ -198,10 +198,11 @@ final class PhrictionDocumentEditor extends PhabricatorEditor {
$ancestors = id(new PhrictionDocument())->loadAllWhere(
'slug IN (%Ls)',
$ancestral_slugs);
$ancestors = mpull($ancestors, null, 'getSlug');
foreach ($ancestral_slugs as $slug) {
// We check for change type to prevent near-infinite recursion
if (!isset($ancestors[$slug]) &&
$new_content->getChangeType() != PhrictionChangeType::CHANGE_PARENT) {
$new_content->getChangeType() != PhrictionChangeType::CHANGE_STUB) {
id(PhrictionDocumentEditor::newForSlug($slug))
->setActor($this->getActor())