1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

Add more detailed story actions for maniphest.

Summary:
TransactionType gives us more information than
update, open, close, assign.  We can display those in feed/notifications along with and comments on the actions.

Test Plan: did on local machine tested out.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: ddfisher, keebuhm, aran, Korvin

Differential Revision: https://secure.phabricator.com/D2683
This commit is contained in:
John-Ashton Allen 2012-06-08 11:28:15 -07:00 committed by epriestley
parent e962ad97fe
commit ec37ce3db7
4 changed files with 60 additions and 15 deletions

View file

@ -1479,7 +1479,7 @@ phutil_register_library_map(array(
'LiskIsolationTestCase' => 'PhabricatorTestCase', 'LiskIsolationTestCase' => 'PhabricatorTestCase',
'LiskIsolationTestDAO' => 'LiskDAO', 'LiskIsolationTestDAO' => 'LiskDAO',
'LiskIsolationTestDAOException' => 'Exception', 'LiskIsolationTestDAOException' => 'Exception',
'ManiphestAction' => 'ManiphestConstants', 'ManiphestAction' => 'PhrictionConstants',
'ManiphestAuxiliaryFieldDefaultSpecification' => 'ManiphestAuxiliaryFieldSpecification', 'ManiphestAuxiliaryFieldDefaultSpecification' => 'ManiphestAuxiliaryFieldSpecification',
'ManiphestAuxiliaryFieldTypeException' => 'Exception', 'ManiphestAuxiliaryFieldTypeException' => 'Exception',
'ManiphestAuxiliaryFieldValidationException' => 'Exception', 'ManiphestAuxiliaryFieldValidationException' => 'Exception',

View file

@ -95,18 +95,31 @@ final class PhabricatorFeedStoryManiphest
$actor_link = $this->linkTo($actor_phid); $actor_link = $this->linkTo($actor_phid);
$task_link = $this->linkTo($task_phid); $task_link = $this->linkTo($task_phid);
$owner_link = $this->linkTo($owner_phid); $owner_link = $this->linkTo($owner_phid);
$verb = ManiphestAction::getActionPastTenseVerb($action); $verb = ManiphestAction::getActionPastTenseVerb($action);
if (($action == ManiphestAction::ACTION_ASSIGN
|| $action == ManiphestAction::ACTION_REASSIGN)
&& !$owner_phid) {
//double assignment since the action is diff in this case
$verb = $action = 'placed up for grabs';
}
$one_line = "{$actor_link} {$verb} {$task_link}"; $one_line = "{$actor_link} {$verb} {$task_link}";
switch ($action) { switch ($action) {
case ManiphestAction::ACTION_ASSIGN: case ManiphestAction::ACTION_ASSIGN:
case ManiphestAction::ACTION_REASSIGN:
$one_line .= " to {$owner_link}"; $one_line .= " to {$owner_link}";
break; break;
default: case ManiphestAction::ACTION_DESCRIPTION:
$one_line .= " to {$description}";
break; break;
} }
if ($comments) {
$one_line .= " \"{$comments}\"";
}
return $one_line; return $one_line;
} }
} }

View file

@ -19,19 +19,41 @@
/** /**
* @group maniphest * @group maniphest
*/ */
final class ManiphestAction extends ManiphestConstants { final class ManiphestAction extends PhrictionConstants {
/* These actions must be determined when the story
is generated and thus are new */
const ACTION_CREATE = 'create'; const ACTION_CREATE = 'create';
const ACTION_REOPEN = 'reopen';
const ACTION_CLOSE = 'close'; const ACTION_CLOSE = 'close';
const ACTION_UPDATE = 'update'; const ACTION_UPDATE = 'update';
const ACTION_ASSIGN = 'assign'; const ACTION_ASSIGN = 'assign';
/* these actions are determined sufficiently by the transaction
type and thus we use them here*/
const ACTION_COMMENT = ManiphestTransactionType::TYPE_NONE;
const ACTION_CC = ManiphestTransactionType::TYPE_CCS;
const ACTION_PRIORITY = ManiphestTransactionType::TYPE_PRIORITY;
const ACTION_PROJECT = ManiphestTransactionType::TYPE_PROJECTS;
const ACTION_TITLE = ManiphestTransactionType::TYPE_TITLE;
const ACTION_DESCRIPTION = ManiphestTransactionType::TYPE_DESCRIPTION;
const ACTION_REASSIGN = ManiphestTransactionType::TYPE_OWNER;
const ACTION_ATTACH = ManiphestTransactionType::TYPE_ATTACH;
public static function getActionPastTenseVerb($action) { public static function getActionPastTenseVerb($action) {
static $map = array( static $map = array(
self::ACTION_CREATE => 'created', self::ACTION_CREATE => 'created',
self::ACTION_CLOSE => 'closed', self::ACTION_CLOSE => 'closed',
self::ACTION_UPDATE => 'updated', self::ACTION_UPDATE => 'updated',
self::ACTION_ASSIGN => 'assigned', self::ACTION_ASSIGN => 'assigned',
self::ACTION_REASSIGN => 'reassigned',
self::ACTION_COMMENT => 'commented on',
self::ACTION_CC => 'updated cc\'s of',
self::ACTION_PRIORITY => 'changed the priority of',
self::ACTION_PROJECT => 'modified projects of',
self::ACTION_TITLE => 'updated title of',
self::ACTION_DESCRIPTION => 'updated description of',
self::ACTION_ATTACH => 'attached something to',
self::ACTION_REOPEN => 'reopened',
); );
return idx($map, $action, "brazenly {$action}'d"); return idx($map, $action, "brazenly {$action}'d");
@ -46,9 +68,18 @@ final class ManiphestAction extends ManiphestConstants {
public static function selectStrongestAction(array $actions) { public static function selectStrongestAction(array $actions) {
static $strengths = array( static $strengths = array(
self::ACTION_UPDATE => 0, self::ACTION_UPDATE => 0,
self::ACTION_ASSIGN => 1, self::ACTION_CC => 1,
self::ACTION_CREATE => 2, self::ACTION_PROJECT => 2,
self::ACTION_CLOSE => 3, self::ACTION_DESCRIPTION => 3,
self::ACTION_TITLE => 4,
self::ACTION_ATTACH => 5,
self::ACTION_COMMENT => 6,
self::ACTION_PRIORITY => 7,
self::ACTION_REASSIGN => 8,
self::ACTION_ASSIGN => 9,
self::ACTION_REOPEN => 10,
self::ACTION_CREATE => 11,
self::ACTION_CLOSE => 12,
); );
$strongest = null; $strongest = null;

View file

@ -329,6 +329,7 @@ final class ManiphestTransactionEditor {
} }
break; break;
default: default:
$actions[] = $type;
break; break;
} }
} }