1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 09:12:41 +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 = ''; $workflow = '';
if ($task->getID()) {
if ($new_title != $task->getTitle()) { if ($new_title != $task->getTitle()) {
$changes[ManiphestTransaction::TYPE_TITLE] = $new_title; $changes[ManiphestTransaction::TYPE_TITLE] = $new_title;
} }
@ -116,12 +115,8 @@ final class ManiphestTaskEditController extends ManiphestController {
if ($new_status != $task->getStatus()) { if ($new_status != $task->getStatus()) {
$changes[ManiphestTransaction::TYPE_STATUS] = $new_status; $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'; $workflow = 'create';
} }
@ -166,6 +161,8 @@ final class ManiphestTaskEditController extends ManiphestController {
} }
if ($errors) { if ($errors) {
$task->setTitle($new_title);
$task->setDescription($new_desc);
$task->setPriority($request->getInt('priority')); $task->setPriority($request->getInt('priority'));
$task->setOwnerPHID($owner_phid); $task->setOwnerPHID($owner_phid);
$task->setCCPHIDs($request->getArr('cc')); $task->setCCPHIDs($request->getArr('cc'));

View file

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

View file

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

View file

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

View file

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