Page MenuHomePhabricator

D7477.id16855.diff
No OneTemporary

D7477.id16855.diff

Index: src/applications/phriction/editor/PhrictionDocumentEditor.php
===================================================================
--- src/applications/phriction/editor/PhrictionDocumentEditor.php
+++ src/applications/phriction/editor/PhrictionDocumentEditor.php
@@ -286,6 +286,22 @@
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 @@
$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

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 28, 10:35 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6715132
Default Alt Text
D7477.id16855.diff (1 KB)

Event Timeline