From c2f0955e9bd2a1ae8c40981356712bf07f560445 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Thu, 20 Nov 2014 17:25:02 -0800 Subject: [PATCH] Add workboard link to emails about workboard changes Summary: Fixes T4652, adding workboard link to emails Test Plan: Move a task in a workboard from one column to another. Email notification should contain "WORKBOARD" section with link to that workboard Reviewers: chad, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T4652 Differential Revision: https://secure.phabricator.com/D10889 --- src/__phutil_library_map__.php | 1 + .../editor/ManiphestTransactionEditor.php | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index b87309f229..db89a79cab 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -5312,6 +5312,7 @@ phutil_register_library_map(array( 'PhabricatorRepositoryDAO', 'PhabricatorPolicyInterface', 'PhabricatorFlaggableInterface', + 'PhabricatorProjectInterface', 'PhabricatorTokenReceiverInterface', 'PhabricatorSubscribableInterface', 'PhabricatorMentionableInterface', diff --git a/src/applications/maniphest/editor/ManiphestTransactionEditor.php b/src/applications/maniphest/editor/ManiphestTransactionEditor.php index 1fb7d2ec52..70ac6f7df8 100644 --- a/src/applications/maniphest/editor/ManiphestTransactionEditor.php +++ b/src/applications/maniphest/editor/ManiphestTransactionEditor.php @@ -501,6 +501,34 @@ final class ManiphestTransactionEditor pht('TASK DETAIL'), PhabricatorEnv::getProductionURI('/T'.$object->getID())); + + $board_phids = array(); + $type_column = ManiphestTransaction::TYPE_PROJECT_COLUMN; + foreach ($xactions as $xaction) { + if ($xaction->getTransactionType() == $type_column) { + $new = $xaction->getNewValue(); + $project_phid = idx($new, 'projectPHID'); + if ($project_phid) { + $board_phids[] = $project_phid; + } + } + } + + if ($board_phids) { + $projects = id(new PhabricatorProjectQuery()) + ->setViewer($this->requireActor()) + ->withPHIDs($board_phids) + ->execute(); + + foreach ($projects as $project) { + $body->addLinkSection( + pht('WORKBOARD'), + PhabricatorEnv::getProductionURI( + '/project/board/'.$project->getID().'/')); + } + } + + return $body; }