2013-09-22 01:23:17 +02:00
|
|
|
<?php
|
|
|
|
|
2013-09-24 19:49:06 +02:00
|
|
|
final class ManiphestTransaction
|
2013-09-22 01:23:17 +02:00
|
|
|
extends PhabricatorApplicationTransaction {
|
|
|
|
|
2013-09-23 23:29:40 +02:00
|
|
|
const TYPE_TITLE = 'title';
|
|
|
|
const TYPE_STATUS = 'status';
|
|
|
|
const TYPE_DESCRIPTION = 'description';
|
|
|
|
const TYPE_OWNER = 'reassign';
|
|
|
|
const TYPE_PRIORITY = 'priority';
|
|
|
|
const TYPE_EDGE = 'edge';
|
2014-02-27 18:39:59 +01:00
|
|
|
const TYPE_SUBPRIORITY = 'subpriority';
|
2014-03-04 00:58:00 +01:00
|
|
|
const TYPE_PROJECT_COLUMN = 'projectcolumn';
|
2014-09-08 23:17:35 +02:00
|
|
|
const TYPE_MERGED_INTO = 'mergedinto';
|
|
|
|
const TYPE_MERGED_FROM = 'mergedfrom';
|
2014-05-19 21:23:17 +02:00
|
|
|
const TYPE_UNBLOCK = 'unblock';
|
2015-12-08 16:54:01 +01:00
|
|
|
const TYPE_PARENT = 'parent';
|
2015-12-09 01:30:49 +01:00
|
|
|
const TYPE_COLUMN = 'column';
|
2016-02-06 23:05:15 +01:00
|
|
|
const TYPE_COVER_IMAGE = 'cover-image';
|
2016-02-09 00:24:52 +01:00
|
|
|
const TYPE_POINTS = 'points';
|
2014-05-19 21:23:17 +02:00
|
|
|
|
2014-04-15 19:49:05 +02:00
|
|
|
// NOTE: this type is deprecated. Keep it around for legacy installs
|
|
|
|
// so any transactions render correctly.
|
|
|
|
const TYPE_ATTACH = 'attach';
|
2014-08-12 23:07:37 +02:00
|
|
|
|
|
|
|
const MAILTAG_STATUS = 'maniphest-status';
|
|
|
|
const MAILTAG_OWNER = 'maniphest-owner';
|
|
|
|
const MAILTAG_PRIORITY = 'maniphest-priority';
|
|
|
|
const MAILTAG_CC = 'maniphest-cc';
|
|
|
|
const MAILTAG_PROJECTS = 'maniphest-projects';
|
|
|
|
const MAILTAG_COMMENT = 'maniphest-comment';
|
|
|
|
const MAILTAG_COLUMN = 'maniphest-column';
|
|
|
|
const MAILTAG_UNBLOCK = 'maniphest-unblock';
|
|
|
|
const MAILTAG_OTHER = 'maniphest-other';
|
|
|
|
|
|
|
|
|
2013-09-22 01:23:17 +02:00
|
|
|
public function getApplicationName() {
|
|
|
|
return 'maniphest';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionType() {
|
2014-07-24 00:05:46 +02:00
|
|
|
return ManiphestTaskPHIDType::TYPECONST;
|
2013-09-22 01:23:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionCommentObject() {
|
2013-09-23 23:24:58 +02:00
|
|
|
return new ManiphestTransactionComment();
|
2013-09-22 01:23:17 +02:00
|
|
|
}
|
|
|
|
|
2014-03-04 00:58:00 +01:00
|
|
|
public function shouldGenerateOldValue() {
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_PROJECT_COLUMN:
|
|
|
|
case self::TYPE_EDGE:
|
2014-05-19 21:23:17 +02:00
|
|
|
case self::TYPE_UNBLOCK:
|
2014-03-05 19:44:21 +01:00
|
|
|
return false;
|
2014-03-04 00:58:00 +01:00
|
|
|
}
|
2014-03-05 19:44:21 +01:00
|
|
|
|
|
|
|
return parent::shouldGenerateOldValue();
|
2014-03-04 00:58:00 +01:00
|
|
|
}
|
|
|
|
|
2014-08-04 21:03:36 +02:00
|
|
|
public function getRemarkupBlocks() {
|
|
|
|
$blocks = parent::getRemarkupBlocks();
|
|
|
|
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_DESCRIPTION:
|
|
|
|
$blocks[] = $this->getNewValue();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $blocks;
|
|
|
|
}
|
|
|
|
|
2013-09-23 23:29:40 +02:00
|
|
|
public function getRequiredHandlePHIDs() {
|
|
|
|
$phids = parent::getRequiredHandlePHIDs();
|
|
|
|
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
$old = $this->getOldValue();
|
|
|
|
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_OWNER:
|
|
|
|
if ($new) {
|
|
|
|
$phids[] = $new;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($old) {
|
|
|
|
$phids[] = $old;
|
|
|
|
}
|
|
|
|
break;
|
2014-03-04 00:58:00 +01:00
|
|
|
case self::TYPE_PROJECT_COLUMN:
|
|
|
|
$phids[] = $new['projectPHID'];
|
|
|
|
$phids[] = head($new['columnPHIDs']);
|
|
|
|
break;
|
2014-09-08 23:17:35 +02:00
|
|
|
case self::TYPE_MERGED_INTO:
|
|
|
|
$phids[] = $new;
|
|
|
|
break;
|
|
|
|
case self::TYPE_MERGED_FROM:
|
|
|
|
$phids = array_merge($phids, $new);
|
|
|
|
break;
|
2013-09-23 23:29:40 +02:00
|
|
|
case self::TYPE_EDGE:
|
|
|
|
$phids = array_mergev(
|
|
|
|
array(
|
|
|
|
$phids,
|
|
|
|
array_keys(nonempty($old, array())),
|
|
|
|
array_keys(nonempty($new, array())),
|
|
|
|
));
|
|
|
|
break;
|
|
|
|
case self::TYPE_ATTACH:
|
|
|
|
$old = nonempty($old, array());
|
|
|
|
$new = nonempty($new, array());
|
|
|
|
$phids = array_mergev(
|
|
|
|
array(
|
|
|
|
$phids,
|
|
|
|
array_keys(idx($new, 'FILE', array())),
|
|
|
|
array_keys(idx($old, 'FILE', array())),
|
|
|
|
));
|
|
|
|
break;
|
2014-05-19 21:23:17 +02:00
|
|
|
case self::TYPE_UNBLOCK:
|
|
|
|
foreach (array_keys($new) as $phid) {
|
|
|
|
$phids[] = $phid;
|
|
|
|
}
|
|
|
|
break;
|
2015-01-06 01:22:07 +01:00
|
|
|
case self::TYPE_STATUS:
|
|
|
|
$commit_phid = $this->getMetadataValue('commitPHID');
|
|
|
|
if ($commit_phid) {
|
|
|
|
$phids[] = $commit_phid;
|
|
|
|
}
|
|
|
|
break;
|
2013-09-23 23:29:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $phids;
|
|
|
|
}
|
|
|
|
|
2013-09-26 22:48:19 +02:00
|
|
|
public function shouldHide() {
|
|
|
|
switch ($this->getTransactionType()) {
|
2015-01-06 01:22:07 +01:00
|
|
|
case PhabricatorTransactions::TYPE_EDGE:
|
|
|
|
$commit_phid = $this->getMetadataValue('commitPHID');
|
|
|
|
$edge_type = $this->getMetadataValue('edge:type');
|
|
|
|
|
|
|
|
if ($edge_type == ManiphestTaskHasCommitEdgeType::EDGECONST) {
|
|
|
|
if ($commit_phid) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2013-09-26 22:48:19 +02:00
|
|
|
case self::TYPE_DESCRIPTION:
|
2013-10-05 00:29:32 +02:00
|
|
|
case self::TYPE_PRIORITY:
|
2014-04-01 23:26:03 +02:00
|
|
|
case self::TYPE_STATUS:
|
2013-09-26 22:48:19 +02:00
|
|
|
if ($this->getOldValue() === null) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
break;
|
2014-02-27 18:39:59 +01:00
|
|
|
case self::TYPE_SUBPRIORITY:
|
2015-12-08 16:54:01 +01:00
|
|
|
case self::TYPE_PARENT:
|
2015-12-09 01:30:49 +01:00
|
|
|
case self::TYPE_COLUMN:
|
2014-02-27 18:39:59 +01:00
|
|
|
return true;
|
2014-08-08 17:11:00 +02:00
|
|
|
case self::TYPE_PROJECT_COLUMN:
|
|
|
|
$old_cols = idx($this->getOldValue(), 'columnPHIDs');
|
|
|
|
$new_cols = idx($this->getNewValue(), 'columnPHIDs');
|
|
|
|
|
|
|
|
$old_cols = array_values($old_cols);
|
|
|
|
$new_cols = array_values($new_cols);
|
|
|
|
sort($old_cols);
|
|
|
|
sort($new_cols);
|
|
|
|
|
|
|
|
return ($old_cols === $new_cols);
|
2016-02-06 23:05:15 +01:00
|
|
|
case self::TYPE_COVER_IMAGE:
|
|
|
|
// At least for now, don't show these.
|
|
|
|
return true;
|
2016-02-09 00:24:52 +01:00
|
|
|
case self::TYPE_POINTS:
|
|
|
|
if (!ManiphestTaskPoints::getIsEnabled()) {
|
|
|
|
return true;
|
|
|
|
}
|
2013-09-26 22:48:19 +02:00
|
|
|
}
|
|
|
|
|
2014-03-05 02:01:33 +01:00
|
|
|
return parent::shouldHide();
|
2013-09-26 22:48:19 +02:00
|
|
|
}
|
|
|
|
|
2016-02-09 00:24:52 +01:00
|
|
|
public function shouldHideForMail(array $xactions) {
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_POINTS:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-02-09 13:17:35 +01:00
|
|
|
return parent::shouldHideForMail($xactions);
|
2016-02-09 00:24:52 +01:00
|
|
|
}
|
|
|
|
|
2015-12-22 01:26:34 +01:00
|
|
|
public function shouldHideForFeed() {
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_UNBLOCK:
|
|
|
|
// Hide "alice created X, a task blocking Y." from feed because it
|
|
|
|
// will almost always appear adjacent to "alice created Y".
|
|
|
|
$is_new = $this->getMetadataValue('blocker.new');
|
|
|
|
if ($is_new) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
2016-02-09 00:24:52 +01:00
|
|
|
case self::TYPE_POINTS:
|
|
|
|
return true;
|
2015-12-22 01:26:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return parent::shouldHideForFeed();
|
|
|
|
}
|
|
|
|
|
2013-09-26 22:48:19 +02:00
|
|
|
public function getActionStrength() {
|
|
|
|
switch ($this->getTransactionType()) {
|
2014-04-01 23:26:03 +02:00
|
|
|
case self::TYPE_TITLE:
|
|
|
|
return 1.4;
|
2013-09-26 22:48:19 +02:00
|
|
|
case self::TYPE_STATUS:
|
|
|
|
return 1.3;
|
|
|
|
case self::TYPE_OWNER:
|
|
|
|
return 1.2;
|
|
|
|
case self::TYPE_PRIORITY:
|
|
|
|
return 1.1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getActionStrength();
|
|
|
|
}
|
|
|
|
|
2013-09-23 23:30:29 +02:00
|
|
|
|
|
|
|
public function getColor() {
|
|
|
|
$old = $this->getOldValue();
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
|
|
|
switch ($this->getTransactionType()) {
|
2013-09-30 02:53:37 +02:00
|
|
|
case self::TYPE_OWNER:
|
|
|
|
if ($this->getAuthorPHID() == $new) {
|
|
|
|
return 'green';
|
|
|
|
} else if (!$new) {
|
|
|
|
return 'black';
|
|
|
|
} else if (!$old) {
|
|
|
|
return 'green';
|
|
|
|
} else {
|
|
|
|
return 'green';
|
|
|
|
}
|
|
|
|
|
2013-09-23 23:30:29 +02:00
|
|
|
case self::TYPE_STATUS:
|
2014-03-25 21:47:42 +01:00
|
|
|
$color = ManiphestTaskStatus::getStatusColor($new);
|
|
|
|
if ($color !== null) {
|
|
|
|
return $color;
|
2013-09-23 23:30:29 +02:00
|
|
|
}
|
2014-03-25 21:56:45 +01:00
|
|
|
|
|
|
|
if (ManiphestTaskStatus::isOpenStatus($new)) {
|
|
|
|
return 'green';
|
|
|
|
} else {
|
2015-01-05 20:19:01 +01:00
|
|
|
return 'indigo';
|
2014-03-25 21:56:45 +01:00
|
|
|
}
|
2013-09-23 23:30:29 +02:00
|
|
|
|
|
|
|
case self::TYPE_PRIORITY:
|
|
|
|
if ($old == ManiphestTaskPriority::getDefaultPriority()) {
|
|
|
|
return 'green';
|
|
|
|
} else if ($old > $new) {
|
|
|
|
return 'grey';
|
|
|
|
} else {
|
|
|
|
return 'yellow';
|
|
|
|
}
|
|
|
|
|
Ref T6500, Duplicated tasks should be marked more visibly as duplicates
Summary: When merging tasks, the corresponding transaction on the merged task should be black, and the transaction on the ultimate task should be green.
Test Plan: Create two tasks, merge one into the other, merged task transaction is black, the surviving task should show a green transaction.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: chad, Korvin, epriestley
Maniphest Tasks: T6500
Differential Revision: https://secure.phabricator.com/D10827
2014-11-12 03:25:19 +01:00
|
|
|
case self::TYPE_MERGED_FROM:
|
|
|
|
return 'orange';
|
|
|
|
|
|
|
|
case self::TYPE_MERGED_INTO:
|
2015-01-05 20:19:01 +01:00
|
|
|
return 'indigo';
|
2013-09-23 23:30:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getColor();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getActionName() {
|
|
|
|
$old = $this->getOldValue();
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_TITLE:
|
2014-03-25 21:47:42 +01:00
|
|
|
if ($old === null) {
|
|
|
|
return pht('Created');
|
|
|
|
}
|
|
|
|
|
2014-04-01 23:26:03 +02:00
|
|
|
return pht('Retitled');
|
|
|
|
|
|
|
|
case self::TYPE_STATUS:
|
2014-03-25 21:47:42 +01:00
|
|
|
$action = ManiphestTaskStatus::getStatusActionName($new);
|
|
|
|
if ($action) {
|
|
|
|
return $action;
|
|
|
|
}
|
|
|
|
|
|
|
|
$old_closed = ManiphestTaskStatus::isClosedStatus($old);
|
|
|
|
$new_closed = ManiphestTaskStatus::isClosedStatus($new);
|
|
|
|
|
|
|
|
if ($new_closed && !$old_closed) {
|
|
|
|
return pht('Closed');
|
|
|
|
} else if (!$new_closed && $old_closed) {
|
|
|
|
return pht('Reopened');
|
|
|
|
} else {
|
|
|
|
return pht('Changed Status');
|
2013-09-23 23:30:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case self::TYPE_DESCRIPTION:
|
|
|
|
return pht('Edited');
|
|
|
|
|
|
|
|
case self::TYPE_OWNER:
|
|
|
|
if ($this->getAuthorPHID() == $new) {
|
|
|
|
return pht('Claimed');
|
|
|
|
} else if (!$new) {
|
|
|
|
return pht('Up For Grabs');
|
|
|
|
} else if (!$old) {
|
|
|
|
return pht('Assigned');
|
|
|
|
} else {
|
|
|
|
return pht('Reassigned');
|
|
|
|
}
|
|
|
|
|
2014-03-04 00:58:00 +01:00
|
|
|
case self::TYPE_PROJECT_COLUMN:
|
|
|
|
return pht('Changed Project Column');
|
|
|
|
|
2013-09-23 23:30:29 +02:00
|
|
|
case self::TYPE_PRIORITY:
|
|
|
|
if ($old == ManiphestTaskPriority::getDefaultPriority()) {
|
|
|
|
return pht('Triaged');
|
|
|
|
} else if ($old > $new) {
|
|
|
|
return pht('Lowered Priority');
|
|
|
|
} else {
|
|
|
|
return pht('Raised Priority');
|
|
|
|
}
|
|
|
|
|
|
|
|
case self::TYPE_EDGE:
|
|
|
|
case self::TYPE_ATTACH:
|
|
|
|
return pht('Attached');
|
2014-05-19 21:23:17 +02:00
|
|
|
|
|
|
|
case self::TYPE_UNBLOCK:
|
|
|
|
$old_status = head($old);
|
|
|
|
$new_status = head($new);
|
|
|
|
|
|
|
|
$old_closed = ManiphestTaskStatus::isClosedStatus($old_status);
|
|
|
|
$new_closed = ManiphestTaskStatus::isClosedStatus($new_status);
|
|
|
|
|
|
|
|
if ($old_closed && !$new_closed) {
|
|
|
|
return pht('Block');
|
|
|
|
} else if (!$old_closed && $new_closed) {
|
|
|
|
return pht('Unblock');
|
|
|
|
} else {
|
|
|
|
return pht('Blocker');
|
|
|
|
}
|
|
|
|
|
2014-09-08 23:17:35 +02:00
|
|
|
case self::TYPE_MERGED_INTO:
|
|
|
|
case self::TYPE_MERGED_FROM:
|
|
|
|
return pht('Merged');
|
|
|
|
|
2013-09-23 23:30:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getActionName();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIcon() {
|
|
|
|
$old = $this->getOldValue();
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
|
|
|
switch ($this->getTransactionType()) {
|
2013-09-30 02:53:37 +02:00
|
|
|
case self::TYPE_OWNER:
|
2014-04-22 17:25:54 +02:00
|
|
|
return 'fa-user';
|
2013-09-30 02:53:37 +02:00
|
|
|
|
2013-09-23 23:30:29 +02:00
|
|
|
case self::TYPE_TITLE:
|
2014-03-25 21:47:42 +01:00
|
|
|
if ($old === null) {
|
2014-04-22 17:25:54 +02:00
|
|
|
return 'fa-pencil';
|
2014-03-25 21:47:42 +01:00
|
|
|
}
|
|
|
|
|
2014-04-22 17:25:54 +02:00
|
|
|
return 'fa-pencil';
|
2014-04-01 23:26:03 +02:00
|
|
|
|
|
|
|
case self::TYPE_STATUS:
|
2014-03-25 21:47:42 +01:00
|
|
|
$action = ManiphestTaskStatus::getStatusIcon($new);
|
|
|
|
if ($action !== null) {
|
|
|
|
return $action;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ManiphestTaskStatus::isClosedStatus($new)) {
|
2014-04-22 23:24:36 +02:00
|
|
|
return 'fa-check';
|
2014-03-25 21:47:42 +01:00
|
|
|
} else {
|
2014-04-22 17:25:54 +02:00
|
|
|
return 'fa-pencil';
|
2013-09-23 23:30:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case self::TYPE_DESCRIPTION:
|
2014-04-22 17:25:54 +02:00
|
|
|
return 'fa-pencil';
|
2013-09-23 23:30:29 +02:00
|
|
|
|
2014-03-04 00:58:00 +01:00
|
|
|
case self::TYPE_PROJECT_COLUMN:
|
2014-04-22 17:25:54 +02:00
|
|
|
return 'fa-columns';
|
2014-03-04 00:58:00 +01:00
|
|
|
|
2014-09-08 23:17:35 +02:00
|
|
|
case self::TYPE_MERGED_INTO:
|
2014-11-20 00:37:47 +01:00
|
|
|
return 'fa-check';
|
2014-09-08 23:17:35 +02:00
|
|
|
case self::TYPE_MERGED_FROM:
|
|
|
|
return 'fa-compress';
|
|
|
|
|
2013-09-23 23:30:29 +02:00
|
|
|
case self::TYPE_PRIORITY:
|
|
|
|
if ($old == ManiphestTaskPriority::getDefaultPriority()) {
|
2014-04-22 17:25:54 +02:00
|
|
|
return 'fa-arrow-right';
|
2013-09-23 23:30:29 +02:00
|
|
|
} else if ($old > $new) {
|
2014-04-22 17:25:54 +02:00
|
|
|
return 'fa-arrow-down';
|
2013-09-23 23:30:29 +02:00
|
|
|
} else {
|
2014-04-22 17:25:54 +02:00
|
|
|
return 'fa-arrow-up';
|
2013-09-23 23:30:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case self::TYPE_EDGE:
|
|
|
|
case self::TYPE_ATTACH:
|
2014-04-22 17:25:54 +02:00
|
|
|
return 'fa-thumb-tack';
|
2013-09-23 23:30:29 +02:00
|
|
|
|
2014-05-19 21:23:17 +02:00
|
|
|
case self::TYPE_UNBLOCK:
|
|
|
|
return 'fa-shield';
|
|
|
|
|
2013-09-23 23:30:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-09-23 23:29:40 +02:00
|
|
|
public function getTitle() {
|
|
|
|
$author_phid = $this->getAuthorPHID();
|
|
|
|
|
|
|
|
$old = $this->getOldValue();
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
|
|
|
switch ($this->getTransactionType()) {
|
2015-12-18 19:14:37 +01:00
|
|
|
case PhabricatorTransactions::TYPE_CREATE:
|
|
|
|
return pht(
|
|
|
|
'%s created this task.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
|
2013-09-23 23:29:40 +02:00
|
|
|
case self::TYPE_TITLE:
|
2014-04-01 23:26:03 +02:00
|
|
|
if ($old === null) {
|
|
|
|
return pht(
|
|
|
|
'%s created this task.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
}
|
2013-09-26 22:48:19 +02:00
|
|
|
return pht(
|
|
|
|
'%s changed the title from "%s" to "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$old,
|
|
|
|
$new);
|
2013-09-23 23:29:40 +02:00
|
|
|
|
|
|
|
case self::TYPE_DESCRIPTION:
|
|
|
|
return pht(
|
|
|
|
'%s edited the task description.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
|
|
|
|
case self::TYPE_STATUS:
|
2014-03-25 21:47:42 +01:00
|
|
|
$old_closed = ManiphestTaskStatus::isClosedStatus($old);
|
|
|
|
$new_closed = ManiphestTaskStatus::isClosedStatus($new);
|
|
|
|
|
|
|
|
$old_name = ManiphestTaskStatus::getTaskStatusName($old);
|
|
|
|
$new_name = ManiphestTaskStatus::getTaskStatusName($new);
|
|
|
|
|
2015-01-06 01:22:07 +01:00
|
|
|
$commit_phid = $this->getMetadataValue('commitPHID');
|
|
|
|
|
2014-03-25 21:47:42 +01:00
|
|
|
if ($new_closed && !$old_closed) {
|
|
|
|
if ($new == ManiphestTaskStatus::getDuplicateStatus()) {
|
2015-01-06 01:22:07 +01:00
|
|
|
if ($commit_phid) {
|
|
|
|
return pht(
|
|
|
|
'%s closed this task as a duplicate by committing %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($commit_phid));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s closed this task as a duplicate.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($commit_phid) {
|
|
|
|
return pht(
|
|
|
|
'%s closed this task as "%s" by committing %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$new_name,
|
|
|
|
$this->renderHandleLink($commit_phid));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s closed this task as "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$new_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!$new_closed && $old_closed) {
|
|
|
|
if ($commit_phid) {
|
2013-09-25 20:16:55 +02:00
|
|
|
return pht(
|
2015-01-06 01:22:07 +01:00
|
|
|
'%s reopened this task as "%s" by committing %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$new_name,
|
|
|
|
$this->renderHandleLink($commit_phid));
|
2014-03-25 21:47:42 +01:00
|
|
|
} else {
|
2013-09-25 20:16:55 +02:00
|
|
|
return pht(
|
2015-01-06 01:22:07 +01:00
|
|
|
'%s reopened this task as "%s".',
|
2013-09-25 20:16:55 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
2014-03-25 21:47:42 +01:00
|
|
|
$new_name);
|
|
|
|
}
|
|
|
|
} else {
|
2015-01-06 01:22:07 +01:00
|
|
|
if ($commit_phid) {
|
|
|
|
return pht(
|
|
|
|
'%s changed the task status from "%s" to "%s" by committing %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$old_name,
|
|
|
|
$new_name,
|
|
|
|
$this->renderHandleLink($commit_phid));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s changed the task status from "%s" to "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$old_name,
|
|
|
|
$new_name);
|
|
|
|
}
|
2013-09-23 23:29:40 +02:00
|
|
|
}
|
|
|
|
|
2014-05-19 21:23:17 +02:00
|
|
|
case self::TYPE_UNBLOCK:
|
|
|
|
$blocker_phid = key($new);
|
|
|
|
$old_status = head($old);
|
|
|
|
$new_status = head($new);
|
|
|
|
|
|
|
|
$old_closed = ManiphestTaskStatus::isClosedStatus($old_status);
|
|
|
|
$new_closed = ManiphestTaskStatus::isClosedStatus($new_status);
|
|
|
|
|
|
|
|
$old_name = ManiphestTaskStatus::getTaskStatusName($old_status);
|
|
|
|
$new_name = ManiphestTaskStatus::getTaskStatusName($new_status);
|
|
|
|
|
2015-12-22 01:26:34 +01:00
|
|
|
if ($this->getMetadataValue('blocker.new')) {
|
|
|
|
return pht(
|
|
|
|
'%s created blocking task %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($blocker_phid));
|
|
|
|
} else if ($old_closed && !$new_closed) {
|
2014-05-19 21:23:17 +02:00
|
|
|
return pht(
|
|
|
|
'%s reopened blocking task %s as "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($blocker_phid),
|
|
|
|
$new_name);
|
|
|
|
} else if (!$old_closed && $new_closed) {
|
|
|
|
return pht(
|
|
|
|
'%s closed blocking task %s as "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($blocker_phid),
|
|
|
|
$new_name);
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s changed the status of blocking task %s from "%s" to "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($blocker_phid),
|
|
|
|
$old_name,
|
|
|
|
$new_name);
|
|
|
|
}
|
|
|
|
|
2013-09-23 23:29:40 +02:00
|
|
|
case self::TYPE_OWNER:
|
|
|
|
if ($author_phid == $new) {
|
|
|
|
return pht(
|
|
|
|
'%s claimed this task.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
} else if (!$new) {
|
|
|
|
return pht(
|
|
|
|
'%s placed this task up for grabs.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
} else if (!$old) {
|
|
|
|
return pht(
|
|
|
|
'%s assigned this task to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($new));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s reassigned this task from %s to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($old),
|
|
|
|
$this->renderHandleLink($new));
|
|
|
|
}
|
|
|
|
|
|
|
|
case self::TYPE_PRIORITY:
|
|
|
|
$old_name = ManiphestTaskPriority::getTaskPriorityName($old);
|
|
|
|
$new_name = ManiphestTaskPriority::getTaskPriorityName($new);
|
|
|
|
|
|
|
|
if ($old == ManiphestTaskPriority::getDefaultPriority()) {
|
|
|
|
return pht(
|
|
|
|
'%s triaged this task as "%s" priority.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$new_name);
|
|
|
|
} else if ($old > $new) {
|
|
|
|
return pht(
|
|
|
|
'%s lowered the priority of this task from "%s" to "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$old_name,
|
|
|
|
$new_name);
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s raised the priority of this task from "%s" to "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$old_name,
|
|
|
|
$new_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
case self::TYPE_ATTACH:
|
|
|
|
$old = nonempty($old, array());
|
|
|
|
$new = nonempty($new, array());
|
|
|
|
$new = array_keys(idx($new, 'FILE', array()));
|
|
|
|
$old = array_keys(idx($old, 'FILE', array()));
|
|
|
|
|
|
|
|
$added = array_diff($new, $old);
|
|
|
|
$removed = array_diff($old, $new);
|
|
|
|
if ($added && !$removed) {
|
|
|
|
return pht(
|
2015-11-02 20:54:38 +01:00
|
|
|
'%s attached %s file(s): %s.',
|
2013-09-23 23:29:40 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
2015-11-02 20:54:38 +01:00
|
|
|
phutil_count($added),
|
2013-09-23 23:29:40 +02:00
|
|
|
$this->renderHandleList($added));
|
|
|
|
} else if ($removed && !$added) {
|
|
|
|
return pht(
|
2015-11-02 20:54:38 +01:00
|
|
|
'%s detached %s file(s): %s.',
|
2013-09-23 23:29:40 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
2015-11-02 20:54:38 +01:00
|
|
|
phutil_count($removed),
|
2013-09-23 23:29:40 +02:00
|
|
|
$this->renderHandleList($removed));
|
|
|
|
} else {
|
|
|
|
return pht(
|
2015-11-02 20:54:38 +01:00
|
|
|
'%s changed file(s), attached %s: %s; detached %s: %s.',
|
2013-09-23 23:29:40 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
2015-11-02 20:54:38 +01:00
|
|
|
phutil_count($added),
|
2013-09-23 23:29:40 +02:00
|
|
|
$this->renderHandleList($added),
|
2015-11-02 20:54:38 +01:00
|
|
|
phutil_count($removed),
|
2013-09-23 23:29:40 +02:00
|
|
|
$this->renderHandleList($removed));
|
|
|
|
}
|
|
|
|
|
2014-03-04 00:58:00 +01:00
|
|
|
case self::TYPE_PROJECT_COLUMN:
|
|
|
|
$project_phid = $new['projectPHID'];
|
|
|
|
$column_phid = head($new['columnPHIDs']);
|
|
|
|
return pht(
|
|
|
|
'%s moved this task to %s on the %s workboard.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($column_phid),
|
|
|
|
$this->renderHandleLink($project_phid));
|
2014-09-08 23:17:35 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case self::TYPE_MERGED_INTO:
|
|
|
|
return pht(
|
Ref T6500, Duplicated tasks should be marked more visibly as duplicates
Summary: When merging tasks, the corresponding transaction on the merged task should be black, and the transaction on the ultimate task should be green.
Test Plan: Create two tasks, merge one into the other, merged task transaction is black, the surviving task should show a green transaction.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: chad, Korvin, epriestley
Maniphest Tasks: T6500
Differential Revision: https://secure.phabricator.com/D10827
2014-11-12 03:25:19 +01:00
|
|
|
'%s closed this task as a duplicate of %s.',
|
2014-09-08 23:17:35 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($new));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case self::TYPE_MERGED_FROM:
|
|
|
|
return pht(
|
2015-11-02 20:54:38 +01:00
|
|
|
'%s merged %s task(s): %s.',
|
2014-09-08 23:17:35 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
2015-11-02 20:54:38 +01:00
|
|
|
phutil_count($new),
|
2014-09-08 23:17:35 +02:00
|
|
|
$this->renderHandleList($new));
|
|
|
|
break;
|
2014-03-04 00:58:00 +01:00
|
|
|
|
2016-02-09 00:24:52 +01:00
|
|
|
case self::TYPE_POINTS:
|
|
|
|
if ($old === null) {
|
|
|
|
return pht(
|
|
|
|
'%s set the point value for this task to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$new);
|
|
|
|
} else if ($new === null) {
|
|
|
|
return pht(
|
|
|
|
'%s removed the point value for this task.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s changed the point value for this task from %s to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$old,
|
|
|
|
$new);
|
|
|
|
}
|
2013-09-23 23:29:40 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getTitle();
|
|
|
|
}
|
|
|
|
|
2015-01-02 17:45:43 +01:00
|
|
|
public function getTitleForFeed() {
|
2013-09-24 23:51:36 +02:00
|
|
|
$author_phid = $this->getAuthorPHID();
|
|
|
|
$object_phid = $this->getObjectPHID();
|
|
|
|
|
|
|
|
$old = $this->getOldValue();
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_TITLE:
|
2014-04-01 23:26:03 +02:00
|
|
|
if ($old === null) {
|
|
|
|
return pht(
|
|
|
|
'%s created %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
}
|
|
|
|
|
2013-09-26 22:48:19 +02:00
|
|
|
return pht(
|
|
|
|
'%s renamed %s from "%s" to "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$old,
|
|
|
|
$new);
|
2013-09-24 23:51:36 +02:00
|
|
|
|
|
|
|
case self::TYPE_DESCRIPTION:
|
|
|
|
return pht(
|
|
|
|
'%s edited the description of %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
|
|
|
|
case self::TYPE_STATUS:
|
2014-03-25 21:47:42 +01:00
|
|
|
$old_closed = ManiphestTaskStatus::isClosedStatus($old);
|
|
|
|
$new_closed = ManiphestTaskStatus::isClosedStatus($new);
|
|
|
|
|
|
|
|
$old_name = ManiphestTaskStatus::getTaskStatusName($old);
|
|
|
|
$new_name = ManiphestTaskStatus::getTaskStatusName($new);
|
|
|
|
|
2015-01-06 01:22:07 +01:00
|
|
|
$commit_phid = $this->getMetadataValue('commitPHID');
|
|
|
|
|
2014-03-25 21:47:42 +01:00
|
|
|
if ($new_closed && !$old_closed) {
|
|
|
|
if ($new == ManiphestTaskStatus::getDuplicateStatus()) {
|
2015-01-06 01:22:07 +01:00
|
|
|
if ($commit_phid) {
|
|
|
|
return pht(
|
|
|
|
'%s closed %s as a duplicate by committing %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$this->renderHandleLink($commit_phid));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s closed %s as a duplicate.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($commit_phid) {
|
|
|
|
return pht(
|
|
|
|
'%s closed %s as "%s" by committing %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$new_name,
|
|
|
|
$this->renderHandleLink($commit_phid));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s closed %s as "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$new_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!$new_closed && $old_closed) {
|
|
|
|
if ($commit_phid) {
|
2013-09-26 22:48:19 +02:00
|
|
|
return pht(
|
2015-01-06 01:22:07 +01:00
|
|
|
'%s reopened %s as "%s" by committing %s.',
|
2013-09-26 22:48:19 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
2015-01-06 01:22:07 +01:00
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$new_name,
|
|
|
|
$this->renderHandleLink($commit_phid));
|
2014-03-25 21:47:42 +01:00
|
|
|
} else {
|
2013-09-26 22:48:19 +02:00
|
|
|
return pht(
|
2015-01-06 01:22:07 +01:00
|
|
|
'%s reopened %s as "%s".',
|
2013-09-26 22:48:19 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
2014-03-25 21:47:42 +01:00
|
|
|
$new_name);
|
|
|
|
}
|
|
|
|
} else {
|
2015-01-06 01:22:07 +01:00
|
|
|
if ($commit_phid) {
|
|
|
|
return pht(
|
|
|
|
'%s changed the status of %s from "%s" to "%s" by committing %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$old_name,
|
|
|
|
$new_name,
|
|
|
|
$this->renderHandleLink($commit_phid));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s changed the status of %s from "%s" to "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$old_name,
|
|
|
|
$new_name);
|
|
|
|
}
|
2013-09-24 23:51:36 +02:00
|
|
|
}
|
|
|
|
|
2014-05-19 21:23:17 +02:00
|
|
|
case self::TYPE_UNBLOCK:
|
2014-08-12 18:27:26 +02:00
|
|
|
$blocker_phid = key($new);
|
|
|
|
$old_status = head($old);
|
|
|
|
$new_status = head($new);
|
2014-05-19 21:23:17 +02:00
|
|
|
|
2014-08-12 18:27:26 +02:00
|
|
|
$old_closed = ManiphestTaskStatus::isClosedStatus($old_status);
|
|
|
|
$new_closed = ManiphestTaskStatus::isClosedStatus($new_status);
|
2014-05-19 21:23:17 +02:00
|
|
|
|
2014-08-12 18:27:26 +02:00
|
|
|
$old_name = ManiphestTaskStatus::getTaskStatusName($old_status);
|
|
|
|
$new_name = ManiphestTaskStatus::getTaskStatusName($new_status);
|
2014-05-19 21:23:17 +02:00
|
|
|
|
2014-08-12 18:27:26 +02:00
|
|
|
if ($old_closed && !$new_closed) {
|
|
|
|
return pht(
|
|
|
|
'%s reopened %s, a task blocking %s, as "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($blocker_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$new_name);
|
|
|
|
} else if (!$old_closed && $new_closed) {
|
|
|
|
return pht(
|
|
|
|
'%s closed %s, a task blocking %s, as "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($blocker_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$new_name);
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s changed the status of %s, a task blocking %s, '.
|
|
|
|
'from "%s" to "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($blocker_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$old_name,
|
|
|
|
$new_name);
|
|
|
|
}
|
2014-05-19 21:23:17 +02:00
|
|
|
|
2013-09-24 23:51:36 +02:00
|
|
|
case self::TYPE_OWNER:
|
|
|
|
if ($author_phid == $new) {
|
|
|
|
return pht(
|
|
|
|
'%s claimed %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
} else if (!$new) {
|
|
|
|
return pht(
|
|
|
|
'%s placed %s up for grabs.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
} else if (!$old) {
|
|
|
|
return pht(
|
|
|
|
'%s assigned %s to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$this->renderHandleLink($new));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s reassigned %s from %s to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$this->renderHandleLink($old),
|
|
|
|
$this->renderHandleLink($new));
|
|
|
|
}
|
|
|
|
|
|
|
|
case self::TYPE_PRIORITY:
|
|
|
|
$old_name = ManiphestTaskPriority::getTaskPriorityName($old);
|
|
|
|
$new_name = ManiphestTaskPriority::getTaskPriorityName($new);
|
|
|
|
|
|
|
|
if ($old == ManiphestTaskPriority::getDefaultPriority()) {
|
|
|
|
return pht(
|
|
|
|
'%s triaged %s as "%s" priority.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$new_name);
|
|
|
|
} else if ($old > $new) {
|
|
|
|
return pht(
|
|
|
|
'%s lowered the priority of %s from "%s" to "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$old_name,
|
|
|
|
$new_name);
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s raised the priority of %s from "%s" to "%s".',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$old_name,
|
|
|
|
$new_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
case self::TYPE_ATTACH:
|
|
|
|
$old = nonempty($old, array());
|
|
|
|
$new = nonempty($new, array());
|
|
|
|
$new = array_keys(idx($new, 'FILE', array()));
|
|
|
|
$old = array_keys(idx($old, 'FILE', array()));
|
|
|
|
|
|
|
|
$added = array_diff($new, $old);
|
|
|
|
$removed = array_diff($old, $new);
|
|
|
|
if ($added && !$removed) {
|
|
|
|
return pht(
|
|
|
|
'%s attached %d file(s) of %s: %s',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
count($added),
|
|
|
|
$this->renderHandleList($added));
|
|
|
|
} else if ($removed && !$added) {
|
|
|
|
return pht(
|
|
|
|
'%s detached %d file(s) of %s: %s',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
count($removed),
|
|
|
|
$this->renderHandleList($removed));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s changed file(s) for %s, attached %d: %s; detached %d: %s',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
count($added),
|
|
|
|
$this->renderHandleList($added),
|
|
|
|
count($removed),
|
|
|
|
$this->renderHandleList($removed));
|
|
|
|
}
|
|
|
|
|
2014-03-04 00:58:00 +01:00
|
|
|
case self::TYPE_PROJECT_COLUMN:
|
|
|
|
$project_phid = $new['projectPHID'];
|
|
|
|
$column_phid = head($new['columnPHIDs']);
|
|
|
|
return pht(
|
2014-03-04 21:05:42 +01:00
|
|
|
'%s moved %s to %s on the %s workboard.',
|
2014-03-04 00:58:00 +01:00
|
|
|
$this->renderHandleLink($author_phid),
|
2014-03-04 21:05:42 +01:00
|
|
|
$this->renderHandleLink($object_phid),
|
2014-03-04 00:58:00 +01:00
|
|
|
$this->renderHandleLink($column_phid),
|
|
|
|
$this->renderHandleLink($project_phid));
|
2014-09-08 23:17:35 +02:00
|
|
|
|
|
|
|
case self::TYPE_MERGED_INTO:
|
|
|
|
return pht(
|
|
|
|
'%s merged task %s into %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$this->renderHandleLink($new));
|
|
|
|
|
|
|
|
case self::TYPE_MERGED_FROM:
|
|
|
|
return pht(
|
2015-11-12 21:04:48 +01:00
|
|
|
'%s merged %s task(s) %s into %s.',
|
2014-09-08 23:17:35 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
2015-11-12 21:04:48 +01:00
|
|
|
phutil_count($new),
|
2014-09-08 23:17:35 +02:00
|
|
|
$this->renderHandleList($new),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
|
2013-09-24 23:51:36 +02:00
|
|
|
}
|
|
|
|
|
2015-01-02 17:45:43 +01:00
|
|
|
return parent::getTitleForFeed();
|
2013-09-24 23:51:36 +02:00
|
|
|
}
|
|
|
|
|
2013-09-23 23:29:40 +02:00
|
|
|
public function hasChangeDetails() {
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_DESCRIPTION:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return parent::hasChangeDetails();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderChangeDetails(PhabricatorUser $viewer) {
|
Allow CustomField to provide ApplicationTransaction change details
Summary:
Ref T3886. Ref T418. For fields like "Summary" and "Test Plan" where changes can't be summarized in one line, allow CustomField to provide a "(Show Details)" link and render a diff.
Also consolidate some of the existing copy/paste, and simplify this featuer slightly now that we've move to dialogs.
Test Plan:
{F115918}
- Viewed "description"-style field changes in phlux, pholio, legalpad, maniphest, differential, ponder (questions), ponder (answers), and repositories.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3886, T418
Differential Revision: https://secure.phabricator.com/D8284
2014-02-21 20:53:04 +01:00
|
|
|
return $this->renderTextCorpusChangeDetails(
|
|
|
|
$viewer,
|
|
|
|
$this->getOldValue(),
|
|
|
|
$this->getNewValue());
|
2013-09-23 23:29:40 +02:00
|
|
|
}
|
|
|
|
|
2013-09-24 15:27:07 +02:00
|
|
|
public function getMailTags() {
|
|
|
|
$tags = array();
|
|
|
|
switch ($this->getTransactionType()) {
|
2014-12-31 17:37:53 +01:00
|
|
|
case self::TYPE_MERGED_INTO:
|
2013-09-24 15:27:07 +02:00
|
|
|
case self::TYPE_STATUS:
|
2014-08-12 23:07:37 +02:00
|
|
|
$tags[] = self::MAILTAG_STATUS;
|
2013-09-24 15:27:07 +02:00
|
|
|
break;
|
|
|
|
case self::TYPE_OWNER:
|
2014-08-12 23:07:37 +02:00
|
|
|
$tags[] = self::MAILTAG_OWNER;
|
2013-09-24 15:27:07 +02:00
|
|
|
break;
|
2014-12-14 16:49:30 +01:00
|
|
|
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
|
2014-08-12 23:07:37 +02:00
|
|
|
$tags[] = self::MAILTAG_CC;
|
2013-09-24 15:27:07 +02:00
|
|
|
break;
|
2014-07-18 00:43:40 +02:00
|
|
|
case PhabricatorTransactions::TYPE_EDGE:
|
|
|
|
switch ($this->getMetadataValue('edge:type')) {
|
|
|
|
case PhabricatorProjectObjectHasProjectEdgeType::EDGECONST:
|
2014-08-12 23:07:37 +02:00
|
|
|
$tags[] = self::MAILTAG_PROJECTS;
|
2014-07-18 00:43:40 +02:00
|
|
|
break;
|
|
|
|
default:
|
2014-08-12 23:07:37 +02:00
|
|
|
$tags[] = self::MAILTAG_OTHER;
|
2014-07-18 00:43:40 +02:00
|
|
|
break;
|
|
|
|
}
|
2013-09-24 15:27:07 +02:00
|
|
|
break;
|
|
|
|
case self::TYPE_PRIORITY:
|
2014-08-12 23:07:37 +02:00
|
|
|
$tags[] = self::MAILTAG_PRIORITY;
|
|
|
|
break;
|
|
|
|
case self::TYPE_UNBLOCK:
|
|
|
|
$tags[] = self::MAILTAG_UNBLOCK;
|
|
|
|
break;
|
|
|
|
case self::TYPE_PROJECT_COLUMN:
|
|
|
|
$tags[] = self::MAILTAG_COLUMN;
|
2013-09-24 15:27:07 +02:00
|
|
|
break;
|
2013-09-24 15:49:31 +02:00
|
|
|
case PhabricatorTransactions::TYPE_COMMENT:
|
2014-08-12 23:07:37 +02:00
|
|
|
$tags[] = self::MAILTAG_COMMENT;
|
2013-09-24 15:27:07 +02:00
|
|
|
break;
|
|
|
|
default:
|
2014-08-12 23:07:37 +02:00
|
|
|
$tags[] = self::MAILTAG_OTHER;
|
2013-09-24 15:27:07 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return $tags;
|
|
|
|
}
|
|
|
|
|
2014-03-14 23:13:51 +01:00
|
|
|
public function getNoEffectDescription() {
|
|
|
|
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_STATUS:
|
|
|
|
return pht('The task already has the selected status.');
|
|
|
|
case self::TYPE_OWNER:
|
|
|
|
return pht('The task already has the selected owner.');
|
|
|
|
case self::TYPE_PRIORITY:
|
|
|
|
return pht('The task already has the selected priority.');
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getNoEffectDescription();
|
|
|
|
}
|
2013-09-23 23:29:40 +02:00
|
|
|
|
2013-09-22 01:23:17 +02:00
|
|
|
}
|