diff --git a/src/applications/phriction/editor/PhrictionDocumentEditor.php b/src/applications/phriction/editor/PhrictionDocumentEditor.php index 55c0c50a5f..effeda2203 100644 --- a/src/applications/phriction/editor/PhrictionDocumentEditor.php +++ b/src/applications/phriction/editor/PhrictionDocumentEditor.php @@ -286,6 +286,22 @@ final class PhrictionDocumentEditor extends PhabricatorEditor { return $this; } + private function getChangeTypeDescription($const, $title) { + $map = array( + PhrictionChangeType::CHANGE_EDIT => + pht("Phriction Document %s was edited.", $title), + PhrictionChangeType::CHANGE_DELETE => + pht("Phriction Document %s was deleted.", $title), + PhrictionChangeType::CHANGE_MOVE_HERE => + pht("Phriction Document %s was moved here.", $title), + PhrictionChangeType::CHANGE_MOVE_AWAY => + pht("Phriction Document %s was moved away.", $title), + PhrictionChangeType::CHANGE_STUB => + pht("Phriction Document %s was created through child.", $title), + ); + return idx($map, $const, pht('Something magical occurred.')); + } + private function sendMailToSubscribers(array $subscribers, $old_content) { if (!$subscribers) { return; @@ -304,14 +320,9 @@ final class PhrictionDocumentEditor extends PhabricatorEditor { $old_title = $old_content->getTitle(); $title = $content->getTitle(); - - // TODO: Currently, this produces something like - // Phriction Document Xyz was Edit - // I'm too lazy to build my own action string everywhere - // Plus, it does not have pht() anyway + $name = $this->getChangeTypeDescription($content->getChangeType(), $title); $action = PhrictionChangeType::getChangeTypeLabel( $content->getChangeType()); - $name = pht("Phriction Document %s was %s", $title, $action); $body = array($name); // Content may have changed, you never know