mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-12 07:41:04 +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:
parent
6b0138c1ae
commit
88bf053ece
2 changed files with 7 additions and 6 deletions
|
@ -9,7 +9,7 @@ final class PhrictionChangeType extends PhrictionConstants {
|
||||||
const CHANGE_DELETE = 1;
|
const CHANGE_DELETE = 1;
|
||||||
const CHANGE_MOVE_HERE = 2;
|
const CHANGE_MOVE_HERE = 2;
|
||||||
const CHANGE_MOVE_AWAY = 3;
|
const CHANGE_MOVE_AWAY = 3;
|
||||||
const CHANGE_PARENT = 4;
|
const CHANGE_STUB = 4;
|
||||||
|
|
||||||
public static function getChangeTypeLabel($const) {
|
public static function getChangeTypeLabel($const) {
|
||||||
static $map = array(
|
static $map = array(
|
||||||
|
@ -17,7 +17,7 @@ final class PhrictionChangeType extends PhrictionConstants {
|
||||||
self::CHANGE_DELETE => 'Delete',
|
self::CHANGE_DELETE => 'Delete',
|
||||||
self::CHANGE_MOVE_HERE => 'Move Here',
|
self::CHANGE_MOVE_HERE => 'Move Here',
|
||||||
self::CHANGE_MOVE_AWAY => 'Move Away',
|
self::CHANGE_MOVE_AWAY => 'Move Away',
|
||||||
self::CHANGE_PARENT => 'Created through child',
|
self::CHANGE_STUB => 'Created through child',
|
||||||
);
|
);
|
||||||
|
|
||||||
return idx($map, $const, '???');
|
return idx($map, $const, '???');
|
||||||
|
|
|
@ -83,13 +83,13 @@ final class PhrictionDocumentEditor extends PhabricatorEditor {
|
||||||
return $this->updateDocument($document, $content, $new_content);
|
return $this->updateDocument($document, $content, $new_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stub() {
|
private function stub() {
|
||||||
$actor = $this->requireActor();
|
$actor = $this->requireActor();
|
||||||
$document = $this->document;
|
$document = $this->document;
|
||||||
$content = $this->content;
|
$content = $this->content;
|
||||||
$new_content = $this->buildContentTemplate($document, $content);
|
$new_content = $this->buildContentTemplate($document, $content);
|
||||||
|
|
||||||
$new_content->setChangeType(PhrictionChangeType::CHANGE_PARENT);
|
$new_content->setChangeType(PhrictionChangeType::CHANGE_STUB);
|
||||||
$new_content->setContent('');
|
$new_content->setContent('');
|
||||||
|
|
||||||
return $this->updateDocument($document, $content, $new_content);
|
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!");
|
"You can not delete a document which doesn't exist yet!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PhrictionChangeType::CHANGE_PARENT:
|
case PhrictionChangeType::CHANGE_STUB:
|
||||||
$doc_status = PhrictionDocumentStatus::STATUS_STUB;
|
$doc_status = PhrictionDocumentStatus::STATUS_STUB;
|
||||||
$feed_action = null;
|
$feed_action = null;
|
||||||
break;
|
break;
|
||||||
|
@ -198,10 +198,11 @@ final class PhrictionDocumentEditor extends PhabricatorEditor {
|
||||||
$ancestors = id(new PhrictionDocument())->loadAllWhere(
|
$ancestors = id(new PhrictionDocument())->loadAllWhere(
|
||||||
'slug IN (%Ls)',
|
'slug IN (%Ls)',
|
||||||
$ancestral_slugs);
|
$ancestral_slugs);
|
||||||
|
$ancestors = mpull($ancestors, null, 'getSlug');
|
||||||
foreach ($ancestral_slugs as $slug) {
|
foreach ($ancestral_slugs as $slug) {
|
||||||
// We check for change type to prevent near-infinite recursion
|
// We check for change type to prevent near-infinite recursion
|
||||||
if (!isset($ancestors[$slug]) &&
|
if (!isset($ancestors[$slug]) &&
|
||||||
$new_content->getChangeType() != PhrictionChangeType::CHANGE_PARENT) {
|
$new_content->getChangeType() != PhrictionChangeType::CHANGE_STUB) {
|
||||||
|
|
||||||
id(PhrictionDocumentEditor::newForSlug($slug))
|
id(PhrictionDocumentEditor::newForSlug($slug))
|
||||||
->setActor($this->getActor())
|
->setActor($this->getActor())
|
||||||
|
|
Loading…
Reference in a new issue