@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+102 -97
+12 -15
src/applications/maniphest/controller/ManiphestTaskEditController.php
··· 106 106 107 107 $workflow = ''; 108 108 109 - if ($task->getID()) { 110 - if ($new_title != $task->getTitle()) { 111 - $changes[ManiphestTransaction::TYPE_TITLE] = $new_title; 112 - } 113 - if ($new_desc != $task->getDescription()) { 114 - $changes[ManiphestTransaction::TYPE_DESCRIPTION] = $new_desc; 115 - } 116 - if ($new_status != $task->getStatus()) { 117 - $changes[ManiphestTransaction::TYPE_STATUS] = $new_status; 118 - } 119 - } else { 120 - $task->setTitle($new_title); 121 - $task->setDescription($new_desc); 122 - $changes[ManiphestTransaction::TYPE_STATUS] = 123 - ManiphestTaskStatus::STATUS_OPEN; 109 + if ($new_title != $task->getTitle()) { 110 + $changes[ManiphestTransaction::TYPE_TITLE] = $new_title; 111 + } 112 + if ($new_desc != $task->getDescription()) { 113 + $changes[ManiphestTransaction::TYPE_DESCRIPTION] = $new_desc; 114 + } 115 + if ($new_status != $task->getStatus()) { 116 + $changes[ManiphestTransaction::TYPE_STATUS] = $new_status; 117 + } 124 118 119 + if (!$task->getID()) { 125 120 $workflow = 'create'; 126 121 } 127 122 ··· 166 161 } 167 162 168 163 if ($errors) { 164 + $task->setTitle($new_title); 165 + $task->setDescription($new_desc); 169 166 $task->setPriority($request->getInt('priority')); 170 167 $task->setOwnerPHID($owner_phid); 171 168 $task->setCCPHIDs($request->getArr('cc'));
+6
src/applications/maniphest/editor/ManiphestTransactionEditorPro.php
··· 148 148 149 149 $body = parent::buildMailBody($object, $xactions); 150 150 151 + if ($this->getIsNewObject()) { 152 + $body->addTextSection( 153 + pht('TASK DESCRIPTION'), 154 + $object->getDescription()); 155 + } 156 + 151 157 $body->addTextSection( 152 158 pht('TASK DETAIL'), 153 159 PhabricatorEnv::getProductionURI('/T'.$object->getID()));
+2 -2
src/applications/maniphest/storage/ManiphestTask.php
··· 22 22 protected $priority; 23 23 protected $subpriority = 0; 24 24 25 - protected $title; 25 + protected $title = ''; 26 26 protected $originalTitle; 27 - protected $description; 27 + protected $description = ''; 28 28 protected $originalEmailSource; 29 29 protected $mailKey; 30 30
+81 -79
src/applications/maniphest/storage/ManiphestTransaction.php
··· 80 80 $new = $this->getNewValue(); 81 81 82 82 switch ($this->getTransactionType()) { 83 + case self::TYPE_TITLE: 84 + if (!strlen($old)) { 85 + return 'green'; 86 + } 87 + 83 88 case self::TYPE_STATUS: 84 89 if ($new == ManiphestTaskStatus::STATUS_OPEN) { 85 - if ($old) { 86 - return 'violet'; 87 - } else { 88 - return 'green'; 89 - } 90 + return 'green'; 90 91 } else { 91 92 return 'black'; 92 93 } ··· 111 112 112 113 switch ($this->getTransactionType()) { 113 114 case self::TYPE_TITLE: 114 - return pht('Retitled'); 115 + if (!strlen($old)) { 116 + return pht('Created'); 117 + } else { 118 + return pht('Retitled'); 119 + } 115 120 116 121 case self::TYPE_STATUS: 117 - if ($new == ManiphestTaskStatus::STATUS_OPEN) { 118 - if ($old) { 122 + switch ($new) { 123 + case ManiphestTaskStatus::STATUS_OPEN: 119 124 return pht('Reopened'); 120 - } else { 121 - return pht('Created'); 122 - } 123 - } else { 124 - switch ($new) { 125 - case ManiphestTaskStatus::STATUS_CLOSED_SPITE: 126 - return pht('Spited'); 127 - case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE: 128 - return pht('Merged'); 129 - default: 130 - return pht('Closed'); 131 - } 125 + case ManiphestTaskStatus::STATUS_CLOSED_SPITE: 126 + return pht('Spited'); 127 + case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE: 128 + return pht('Merged'); 129 + default: 130 + return pht('Closed'); 132 131 } 133 132 134 133 case self::TYPE_DESCRIPTION: ··· 174 173 175 174 switch ($this->getTransactionType()) { 176 175 case self::TYPE_TITLE: 177 - return 'edit'; 176 + if (!strlen($old)) { 177 + return 'create'; 178 + } else { 179 + return 'edit'; 180 + } 178 181 179 182 case self::TYPE_STATUS: 180 - if ($new == ManiphestTaskStatus::STATUS_OPEN) { 181 - return 'create'; 182 - } else { 183 - switch ($new) { 184 - case ManiphestTaskStatus::STATUS_CLOSED_SPITE: 185 - return 'dislike'; 186 - case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE: 187 - return 'delete'; 188 - default: 189 - return 'check'; 190 - } 183 + switch ($new) { 184 + case ManiphestTaskStatus::STATUS_OPEN: 185 + return 'create'; 186 + case ManiphestTaskStatus::STATUS_CLOSED_SPITE: 187 + return 'dislike'; 188 + case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE: 189 + return 'delete'; 190 + default: 191 + return 'check'; 191 192 } 192 193 193 194 case self::TYPE_DESCRIPTION: ··· 225 226 226 227 switch ($this->getTransactionType()) { 227 228 case self::TYPE_TITLE: 228 - return pht( 229 - '%s changed the title from "%s" to "%s".', 230 - $this->renderHandleLink($author_phid), 231 - $old, 232 - $new); 229 + if (!strlen($old)) { 230 + return pht( 231 + '%s created this task.', 232 + $this->renderHandleLink($author_phid), 233 + $old, 234 + $new); 235 + } else { 236 + return pht( 237 + '%s changed the title from "%s" to "%s".', 238 + $this->renderHandleLink($author_phid), 239 + $old, 240 + $new); 241 + } 233 242 234 243 case self::TYPE_DESCRIPTION: 235 244 return pht( ··· 237 246 $this->renderHandleLink($author_phid)); 238 247 239 248 case self::TYPE_STATUS: 240 - if ($new == ManiphestTaskStatus::STATUS_OPEN) { 241 - if ($old) { 249 + switch ($new) { 250 + case ManiphestTaskStatus::STATUS_OPEN: 242 251 return pht( 243 252 '%s reopened this task.', 244 253 $this->renderHandleLink($author_phid)); 245 - } else { 254 + 255 + case ManiphestTaskStatus::STATUS_CLOSED_SPITE: 246 256 return pht( 247 - '%s created this task.', 257 + '%s closed this task out of spite.', 248 258 $this->renderHandleLink($author_phid)); 249 - } 250 - } else { 251 - switch ($new) { 252 - case ManiphestTaskStatus::STATUS_CLOSED_SPITE: 253 - return pht( 254 - '%s closed this task out of spite.', 255 - $this->renderHandleLink($author_phid)); 256 - case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE: 257 - return pht( 258 - '%s closed this task as a duplicate.', 259 - $this->renderHandleLink($author_phid)); 260 - default: 261 - $status_name = idx( 262 - ManiphestTaskStatus::getTaskStatusMap(), 263 - $new, 264 - '???'); 265 - return pht( 266 - '%s closed this task as "%s".', 267 - $this->renderHandleLink($author_phid), 268 - $status_name); 269 - } 259 + case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE: 260 + return pht( 261 + '%s closed this task as a duplicate.', 262 + $this->renderHandleLink($author_phid)); 263 + default: 264 + $status_name = idx( 265 + ManiphestTaskStatus::getTaskStatusMap(), 266 + $new, 267 + '???'); 268 + return pht( 269 + '%s closed this task as "%s".', 270 + $this->renderHandleLink($author_phid), 271 + $status_name); 270 272 } 271 273 272 274 case self::TYPE_OWNER: ··· 403 405 404 406 switch ($this->getTransactionType()) { 405 407 case self::TYPE_TITLE: 406 - return pht( 407 - '%s renamed %s from "%s" to "%s".', 408 - $this->renderHandleLink($author_phid), 409 - $this->renderHandleLink($object_phid), 410 - $old, 411 - $new); 408 + if (!strlen($old)) { 409 + return pht( 410 + '%s created %s.', 411 + $this->renderHandleLink($author_phid), 412 + $this->renderHandleLink($object_phid)); 413 + } else { 414 + return pht( 415 + '%s renamed %s from "%s" to "%s".', 416 + $this->renderHandleLink($author_phid), 417 + $this->renderHandleLink($object_phid), 418 + $old, 419 + $new); 420 + } 412 421 413 422 case self::TYPE_DESCRIPTION: 414 423 return pht( ··· 418 427 419 428 case self::TYPE_STATUS: 420 429 if ($new == ManiphestTaskStatus::STATUS_OPEN) { 421 - if ($old) { 422 - return pht( 423 - '%s reopened %s.', 424 - $this->renderHandleLink($author_phid), 425 - $this->renderHandleLink($object_phid)); 426 - } else { 427 - return pht( 428 - '%s created %s.', 429 - $this->renderHandleLink($author_phid), 430 - $this->renderHandleLink($object_phid)); 431 - } 430 + return pht( 431 + '%s reopened %s.', 432 + $this->renderHandleLink($author_phid), 433 + $this->renderHandleLink($object_phid)); 432 434 } else { 433 435 switch ($new) { 434 436 case ManiphestTaskStatus::STATUS_CLOSED_SPITE:
+1 -1
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 62 62 * @return this 63 63 */ 64 64 public function setMailTags(array $tags) { 65 - $this->setParam('mailtags', $tags); 65 + $this->setParam('mailtags', array_unique($tags)); 66 66 return $this; 67 67 } 68 68