1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 15:22: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,22 +106,17 @@ 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; }
} if ($new_desc != $task->getDescription()) {
if ($new_desc != $task->getDescription()) { $changes[ManiphestTransaction::TYPE_DESCRIPTION] = $new_desc;
$changes[ManiphestTransaction::TYPE_DESCRIPTION] = $new_desc; }
} 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_TITLE:
if (!strlen($old)) {
return 'green';
}
case self::TYPE_STATUS: case self::TYPE_STATUS:
if ($new == ManiphestTaskStatus::STATUS_OPEN) { if ($new == ManiphestTaskStatus::STATUS_OPEN) {
if ($old) { return 'green';
return 'violet';
} else {
return 'green';
}
} else { } else {
return 'black'; return 'black';
} }
@ -111,24 +112,22 @@ final class ManiphestTransaction
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case self::TYPE_TITLE: case self::TYPE_TITLE:
return pht('Retitled'); if (!strlen($old)) {
return pht('Created');
} else {
return pht('Retitled');
}
case self::TYPE_STATUS: case self::TYPE_STATUS:
if ($new == ManiphestTaskStatus::STATUS_OPEN) { switch ($new) {
if ($old) { case ManiphestTaskStatus::STATUS_OPEN:
return pht('Reopened'); return pht('Reopened');
} else { case ManiphestTaskStatus::STATUS_CLOSED_SPITE:
return pht('Created'); return pht('Spited');
} case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE:
} else { return pht('Merged');
switch ($new) { default:
case ManiphestTaskStatus::STATUS_CLOSED_SPITE: return pht('Closed');
return pht('Spited');
case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE:
return pht('Merged');
default:
return pht('Closed');
}
} }
case self::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
@ -174,20 +173,22 @@ 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 {
switch ($new) { return 'edit';
case ManiphestTaskStatus::STATUS_CLOSED_SPITE: }
return 'dislike';
case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE: case self::TYPE_STATUS:
return 'delete'; switch ($new) {
default: case ManiphestTaskStatus::STATUS_OPEN:
return 'check'; return 'create';
} case ManiphestTaskStatus::STATUS_CLOSED_SPITE:
return 'dislike';
case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE:
return 'delete';
default:
return 'check';
} }
case self::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
@ -225,11 +226,19 @@ final class ManiphestTransaction
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case self::TYPE_TITLE: case self::TYPE_TITLE:
return pht( if (!strlen($old)) {
'%s changed the title from "%s" to "%s".', return pht(
$this->renderHandleLink($author_phid), '%s created this task.',
$old, $this->renderHandleLink($author_phid),
$new); $old,
$new);
} else {
return pht(
'%s changed the title from "%s" to "%s".',
$this->renderHandleLink($author_phid),
$old,
$new);
}
case self::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
return pht( return pht(
@ -237,36 +246,29 @@ 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 {
case ManiphestTaskStatus::STATUS_CLOSED_SPITE:
return pht( return pht(
'%s created this task.', '%s closed this task out of spite.',
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
} case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE:
} else { return pht(
switch ($new) { '%s closed this task as a duplicate.',
case ManiphestTaskStatus::STATUS_CLOSED_SPITE: $this->renderHandleLink($author_phid));
return pht( default:
'%s closed this task out of spite.', $status_name = idx(
$this->renderHandleLink($author_phid)); ManiphestTaskStatus::getTaskStatusMap(),
case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE: $new,
return pht( '???');
'%s closed this task as a duplicate.', return pht(
$this->renderHandleLink($author_phid)); '%s closed this task as "%s".',
default: $this->renderHandleLink($author_phid),
$status_name = idx( $status_name);
ManiphestTaskStatus::getTaskStatusMap(),
$new,
'???');
return pht(
'%s closed this task as "%s".',
$this->renderHandleLink($author_phid),
$status_name);
}
} }
case self::TYPE_OWNER: case self::TYPE_OWNER:
@ -403,12 +405,19 @@ final class ManiphestTransaction
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case self::TYPE_TITLE: case self::TYPE_TITLE:
return pht( if (!strlen($old)) {
'%s renamed %s from "%s" to "%s".', return pht(
$this->renderHandleLink($author_phid), '%s created %s.',
$this->renderHandleLink($object_phid), $this->renderHandleLink($author_phid),
$old, $this->renderHandleLink($object_phid));
$new); } else {
return pht(
'%s renamed %s from "%s" to "%s".',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid),
$old,
$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;
} }