1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-17 09:18:44 +01:00

Restore some missing features from Maniphest mail

Summary:
Ref T2217. Fixes two issues:

  # The "task created" email didn't include the task description, but should.
  # We were treaging the "status" event as the "create", but that's kind of a mess. Treat the "title" event as the "create" instead. This makes initial emails say "[Created]".

Test Plan: Created some tasks, got better emails.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T2217

Differential Revision: https://secure.phabricator.com/D7115
This commit is contained in:
epriestley 2013-09-25 11:16:55 -07:00
parent bb4bf01bdc
commit 6d45a2e09b
5 changed files with 102 additions and 97 deletions

View file

@ -106,7 +106,6 @@ final class ManiphestTaskEditController extends ManiphestController {
$workflow = '';
if ($task->getID()) {
if ($new_title != $task->getTitle()) {
$changes[ManiphestTransaction::TYPE_TITLE] = $new_title;
}
@ -116,12 +115,8 @@ final class ManiphestTaskEditController extends ManiphestController {
if ($new_status != $task->getStatus()) {
$changes[ManiphestTransaction::TYPE_STATUS] = $new_status;
}
} else {
$task->setTitle($new_title);
$task->setDescription($new_desc);
$changes[ManiphestTransaction::TYPE_STATUS] =
ManiphestTaskStatus::STATUS_OPEN;
if (!$task->getID()) {
$workflow = 'create';
}
@ -166,6 +161,8 @@ final class ManiphestTaskEditController extends ManiphestController {
}
if ($errors) {
$task->setTitle($new_title);
$task->setDescription($new_desc);
$task->setPriority($request->getInt('priority'));
$task->setOwnerPHID($owner_phid);
$task->setCCPHIDs($request->getArr('cc'));

View file

@ -148,6 +148,12 @@ final class ManiphestTransactionEditorPro
$body = parent::buildMailBody($object, $xactions);
if ($this->getIsNewObject()) {
$body->addTextSection(
pht('TASK DESCRIPTION'),
$object->getDescription());
}
$body->addTextSection(
pht('TASK DETAIL'),
PhabricatorEnv::getProductionURI('/T'.$object->getID()));

View file

@ -22,9 +22,9 @@ final class ManiphestTask extends ManiphestDAO
protected $priority;
protected $subpriority = 0;
protected $title;
protected $title = '';
protected $originalTitle;
protected $description;
protected $description = '';
protected $originalEmailSource;
protected $mailKey;

View file

@ -80,13 +80,14 @@ final class ManiphestTransaction
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case self::TYPE_STATUS:
if ($new == ManiphestTaskStatus::STATUS_OPEN) {
if ($old) {
return 'violet';
} else {
case self::TYPE_TITLE:
if (!strlen($old)) {
return 'green';
}
case self::TYPE_STATUS:
if ($new == ManiphestTaskStatus::STATUS_OPEN) {
return 'green';
} else {
return 'black';
}
@ -111,17 +112,16 @@ final class ManiphestTransaction
switch ($this->getTransactionType()) {
case self::TYPE_TITLE:
if (!strlen($old)) {
return pht('Created');
} else {
return pht('Retitled');
}
case self::TYPE_STATUS:
if ($new == ManiphestTaskStatus::STATUS_OPEN) {
if ($old) {
return pht('Reopened');
} else {
return pht('Created');
}
} else {
switch ($new) {
case ManiphestTaskStatus::STATUS_OPEN:
return pht('Reopened');
case ManiphestTaskStatus::STATUS_CLOSED_SPITE:
return pht('Spited');
case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE:
@ -129,7 +129,6 @@ final class ManiphestTransaction
default:
return pht('Closed');
}
}
case self::TYPE_DESCRIPTION:
return pht('Edited');
@ -174,13 +173,16 @@ final class ManiphestTransaction
switch ($this->getTransactionType()) {
case self::TYPE_TITLE:
return 'edit';
case self::TYPE_STATUS:
if ($new == ManiphestTaskStatus::STATUS_OPEN) {
if (!strlen($old)) {
return 'create';
} else {
return 'edit';
}
case self::TYPE_STATUS:
switch ($new) {
case ManiphestTaskStatus::STATUS_OPEN:
return 'create';
case ManiphestTaskStatus::STATUS_CLOSED_SPITE:
return 'dislike';
case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE:
@ -188,7 +190,6 @@ final class ManiphestTransaction
default:
return 'check';
}
}
case self::TYPE_DESCRIPTION:
return 'edit';
@ -225,11 +226,19 @@ final class ManiphestTransaction
switch ($this->getTransactionType()) {
case self::TYPE_TITLE:
if (!strlen($old)) {
return pht(
'%s created this task.',
$this->renderHandleLink($author_phid),
$old,
$new);
} else {
return pht(
'%s changed the title from "%s" to "%s".',
$this->renderHandleLink($author_phid),
$old,
$new);
}
case self::TYPE_DESCRIPTION:
return pht(
@ -237,18 +246,12 @@ final class ManiphestTransaction
$this->renderHandleLink($author_phid));
case self::TYPE_STATUS:
if ($new == ManiphestTaskStatus::STATUS_OPEN) {
if ($old) {
switch ($new) {
case ManiphestTaskStatus::STATUS_OPEN:
return pht(
'%s reopened this task.',
$this->renderHandleLink($author_phid));
} else {
return pht(
'%s created this task.',
$this->renderHandleLink($author_phid));
}
} else {
switch ($new) {
case ManiphestTaskStatus::STATUS_CLOSED_SPITE:
return pht(
'%s closed this task out of spite.',
@ -267,7 +270,6 @@ final class ManiphestTransaction
$this->renderHandleLink($author_phid),
$status_name);
}
}
case self::TYPE_OWNER:
if ($author_phid == $new) {
@ -403,12 +405,19 @@ final class ManiphestTransaction
switch ($this->getTransactionType()) {
case self::TYPE_TITLE:
if (!strlen($old)) {
return pht(
'%s created %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
} else {
return pht(
'%s renamed %s from "%s" to "%s".',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid),
$old,
$new);
}
case self::TYPE_DESCRIPTION:
return pht(
@ -418,17 +427,10 @@ final class ManiphestTransaction
case self::TYPE_STATUS:
if ($new == ManiphestTaskStatus::STATUS_OPEN) {
if ($old) {
return pht(
'%s reopened %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
} else {
return pht(
'%s created %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
}
} else {
switch ($new) {
case ManiphestTaskStatus::STATUS_CLOSED_SPITE:

View file

@ -62,7 +62,7 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
* @return this
*/
public function setMailTags(array $tags) {
$this->setParam('mailtags', $tags);
$this->setParam('mailtags', array_unique($tags));
return $this;
}