Page MenuHomePhabricator

D8175.id18488.diff
No OneTemporary

D8175.id18488.diff

diff --git a/src/applications/differential/constants/DifferentialAction.php b/src/applications/differential/constants/DifferentialAction.php
--- a/src/applications/differential/constants/DifferentialAction.php
+++ b/src/applications/differential/constants/DifferentialAction.php
@@ -20,6 +20,84 @@
const ACTION_CLAIM = 'claim';
const ACTION_REOPEN = 'reopen';
+ public static function getBasicStoryText($action, $author_name) {
+ switch ($action) {
+ case DifferentialAction::ACTION_COMMENT:
+ $title = pht('%s commented on this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_ACCEPT:
+ $title = pht('%s accepted this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_REJECT:
+ $title = pht('%s requested changes to this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_RETHINK:
+ $title = pht('%s planned changes to this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_ABANDON:
+ $title = pht('%s abandoned this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_CLOSE:
+ $title = pht('%s closed this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_REQUEST:
+ $title = pht('%s requested a review of this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_RECLAIM:
+ $title = pht('%s reclaimed this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_UPDATE:
+ $title = pht('%s updated this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_RESIGN:
+ $title = pht('%s resigned from this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_SUMMARIZE:
+ $title = pht('%s summarized this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_TESTPLAN:
+ $title = pht('%s explained the test plan for this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_CREATE:
+ $title = pht('%s created this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_ADDREVIEWERS:
+ $title = pht('%s added reviewers to this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_ADDCCS:
+ $title = pht('%s added CCs to this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_CLAIM:
+ $title = pht('%s commandeered this revision.',
+ $author_name);
+ break;
+ case DifferentialAction::ACTION_REOPEN:
+ $title = pht('%s reopened this revision.',
+ $author_name);
+ break;
+ default:
+ $title = pht('Ghosts happened to this revision.');
+ break;
+ }
+ return $title;
+ }
+
+ /* legacy, for just mail now */
public static function getActionPastTenseVerb($action) {
$verbs = array(
self::ACTION_COMMENT => 'commented on',
diff --git a/src/applications/differential/view/DifferentialRevisionCommentView.php b/src/applications/differential/view/DifferentialRevisionCommentView.php
--- a/src/applications/differential/view/DifferentialRevisionCommentView.php
+++ b/src/applications/differential/view/DifferentialRevisionCommentView.php
@@ -112,20 +112,17 @@
DifferentialComment::METADATA_ADDED_CCS,
array());
- $verb = DifferentialAction::getActionPastTenseVerb($comment->getAction());
-
$actions = array();
- // TODO: i18n
switch ($comment->getAction()) {
case DifferentialAction::ACTION_ADDCCS:
- $actions[] = hsprintf(
+ $actions[] = pht(
"%s added CCs: %s.",
$author_link,
$this->renderHandleList($added_ccs));
$added_ccs = null;
break;
case DifferentialAction::ACTION_ADDREVIEWERS:
- $actions[] = hsprintf(
+ $actions[] = pht(
"%s added reviewers: %s.",
$author_link,
$this->renderHandleList($added_reviewers));
@@ -140,41 +137,37 @@
'href' => '/D'.$comment->getRevisionID().'?id='.$diff_id,
),
'Diff #'.$diff_id);
- $actions[] = hsprintf(
+ $actions[] = pht(
"%s updated this revision to %s.",
$author_link,
$diff_link);
} else {
- $actions[] = hsprintf(
- "%s %s this revision.",
- $author_link,
- $verb);
+ $actions[] = DifferentialAction::getBasicStoryText(
+ $comment->getAction(), $author_link);
}
break;
default:
- $actions[] = hsprintf(
- "%s %s this revision.",
- $author_link,
- $verb);
+ $actions[] = DifferentialAction::getBasicStoryText(
+ $comment->getAction(), $author_link);
break;
}
if ($added_reviewers) {
- $actions[] = hsprintf(
+ $actions[] = pht(
"%s added reviewers: %s.",
$author_link,
$this->renderHandleList($added_reviewers));
}
if ($removed_reviewers) {
- $actions[] = hsprintf(
+ $actions[] = pht(
"%s removed reviewers: %s.",
$author_link,
$this->renderHandleList($removed_reviewers));
}
if ($added_ccs) {
- $actions[] = hsprintf(
+ $actions[] = pht(
"%s added CCs: %s.",
$author_link,
$this->renderHandleList($added_ccs));
diff --git a/src/applications/feed/story/PhabricatorFeedStoryDifferential.php b/src/applications/feed/story/PhabricatorFeedStoryDifferential.php
--- a/src/applications/feed/story/PhabricatorFeedStoryDifferential.php
+++ b/src/applications/feed/story/PhabricatorFeedStoryDifferential.php
@@ -48,13 +48,76 @@
$actor_link = $this->linkTo($actor_phid);
$revision_link = $this->linkTo($revision_phid);
- $verb = DifferentialAction::getActionPastTenseVerb($action);
-
- $one_line = hsprintf(
- '%s %s revision %s',
- $actor_link,
- $verb,
- $revision_link);
+ switch ($action) {
+ case DifferentialAction::ACTION_COMMENT:
+ $one_line = pht('%s commented on revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_ACCEPT:
+ $one_line = pht('%s accepted revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_REJECT:
+ $one_line = pht('%s requested changes to revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_RETHINK:
+ $one_line = pht('%s planned changes to revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_ABANDON:
+ $one_line = pht('%s abandoned revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_CLOSE:
+ $one_line = pht('%s closed revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_REQUEST:
+ $one_line = pht('%s requested a review of revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_RECLAIM:
+ $one_line = pht('%s reclaimed revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_UPDATE:
+ $one_line = pht('%s updated revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_RESIGN:
+ $one_line = pht('%s resigned from revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_SUMMARIZE:
+ $one_line = pht('%s summarized revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_TESTPLAN:
+ $one_line = pht('%s explained the test plan for revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_CREATE:
+ $one_line = pht('%s created revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_ADDREVIEWERS:
+ $one_line = pht('%s added reviewers to revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_ADDCCS:
+ $one_line = pht('%s added CCs to revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_CLAIM:
+ $one_line = pht('%s commandeered revision %s',
+ $actor_link, $revision_link);
+ break;
+ case DifferentialAction::ACTION_REOPEN:
+ $one_line = pht('%s reopened revision %s',
+ $actor_link, $revision_link);
+ break;
+ }
return $one_line;
}
@@ -67,11 +130,79 @@
$revision_uri = PhabricatorEnv::getURI($revision_handle->getURI());
$action = $this->getValue('action');
- $verb = DifferentialAction::getActionPastTenseVerb($action);
- $text = "{$author_name} {$verb} revision {$revision_title} {$revision_uri}";
+ switch ($action) {
+ case DifferentialAction::ACTION_COMMENT:
+ $one_line = pht('%s commented on revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_ACCEPT:
+ $one_line = pht('%s accepted revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_REJECT:
+ $one_line = pht('%s requested changes to revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_RETHINK:
+ $one_line = pht('%s planned changes to revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_ABANDON:
+ $one_line = pht('%s abandoned revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_CLOSE:
+ $one_line = pht('%s closed revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_REQUEST:
+ $one_line = pht('%s requested a review of revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_RECLAIM:
+ $one_line = pht('%s reclaimed revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_UPDATE:
+ $one_line = pht('%s updated revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_RESIGN:
+ $one_line = pht('%s resigned from revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_SUMMARIZE:
+ $one_line = pht('%s summarized revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_TESTPLAN:
+ $one_line = pht('%s explained the test plan for revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_CREATE:
+ $one_line = pht('%s created revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_ADDREVIEWERS:
+ $one_line = pht('%s added reviewers to revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_ADDCCS:
+ $one_line = pht('%s added CCs to revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_CLAIM:
+ $one_line = pht('%s commandeered revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ case DifferentialAction::ACTION_REOPEN:
+ $one_line = pht('%s reopened revision %s %s',
+ $author_name, $revision_title, $revision_uri);
+ break;
+ }
- return $text;
+ return $one_line;
}
public function getNotificationAggregations() {
@@ -96,7 +227,6 @@
$author_name = $this->getHandle($this->getAuthorPHID())->getName();
$action = $this->getValue('action');
- $verb = DifferentialAction::getActionPastTenseVerb($action);
$engine = PhabricatorMarkupEngine::newMarkupEngine(array())
->setConfig('viewer', new PhabricatorUser())
@@ -106,9 +236,79 @@
$revision_name = $this->getHandle($revision_phid)->getFullName();
if ($implied_context) {
- $title = "{$author_name} {$verb} this revision.";
+ $title = DifferentialAction::getBasicStoryText(
+ $action, $author_name);
} else {
- $title = "{$author_name} {$verb} revision {$revision_name}.";
+ switch ($action) {
+ case DifferentialAction::ACTION_COMMENT:
+ $title = pht('%s commented on revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_ACCEPT:
+ $title = pht('%s accepted revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_REJECT:
+ $title = pht('%s requested changes to revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_RETHINK:
+ $title = pht('%s planned changes to revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_ABANDON:
+ $title = pht('%s abandoned revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_CLOSE:
+ $title = pht('%s closed revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_REQUEST:
+ $title = pht('%s requested a review of revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_RECLAIM:
+ $title = pht('%s reclaimed revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_UPDATE:
+ $title = pht('%s updated revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_RESIGN:
+ $title = pht('%s resigned from revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_SUMMARIZE:
+ $title = pht('%s summarized revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_TESTPLAN:
+ $title = pht('%s explained the test plan for revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_CREATE:
+ $title = pht('%s created revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_ADDREVIEWERS:
+ $title = pht('%s added reviewers to revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_ADDCCS:
+ $title = pht('%s added CCs to revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_CLAIM:
+ $title = pht('%s commandeered revision %s',
+ $author_name, $revision_name);
+ break;
+ case DifferentialAction::ACTION_REOPEN:
+ $title = pht('%s reopened revision %s',
+ $author_name, $revision_name);
+ break;
+ }
}
if (strlen($comment)) {

File Metadata

Mime Type
text/plain
Expires
May 25 2024, 11:55 AM (5 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6308091
Default Alt Text
D8175.id18488.diff (15 KB)

Event Timeline