mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 04:50:55 +01:00
Prevent "Maniphest Tasks" field from creating empty comment when revisions are
updated Summary: - If you update a revision with a nonempty "Maniphest Tasks" field, an empty comment is posted (see T586). - The transaction email currently says "Attached revision 'Unknown Differential Revision'", move attaching to "didWriteRevision()" to make sure the object has been written. Test Plan: - Attached; updated a revision. Reviewers: btrahan, jungejason Reviewed By: btrahan CC: aran, btrahan Maniphest Tasks: T685 Differential Revision: 1223
This commit is contained in:
parent
3cd92ab075
commit
dfc3506240
1 changed files with 6 additions and 1 deletions
|
@ -58,7 +58,7 @@ final class DifferentialManiphestTasksFieldSpecification
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function willWriteRevision(DifferentialRevisionEditor $editor) {
|
||||
public function didWriteRevision(DifferentialRevisionEditor $editor) {
|
||||
// 1 -- revision => tasks
|
||||
$revision = $editor->getRevision();
|
||||
$revision->setAttachedPHIDs(PhabricatorPHIDConstants::PHID_TYPE_TASK,
|
||||
|
@ -86,6 +86,11 @@ final class DifferentialManiphestTasksFieldSpecification
|
|||
if (empty($new[$attach_type])) {
|
||||
$new[$attach_type] = array();
|
||||
}
|
||||
if (array_key_exists($revision->getPHID(), $new[$attach_type])) {
|
||||
// Already attached, just skip the update.
|
||||
continue;
|
||||
}
|
||||
|
||||
$new[$attach_type][$revision->getPHID()] = array();
|
||||
|
||||
$transaction->setNewValue($new);
|
||||
|
|
Loading…
Reference in a new issue