From 9889892e5b769acafd0b373b8548b8ffcec9f0f2 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 18 Apr 2014 17:51:59 -0700 Subject: [PATCH] Actually squelch Harbormaster "test passed" mail Summary: Ref T1049. When Harbormaster tests pass, don't bother sending an email about it. (I tried to implement this earlier but didn't test it entirely properly, and we needed a little more code.) Test Plan: Used `bin/harbormaster build` to build some junk, got no email about passes. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T1049 Differential Revision: https://secure.phabricator.com/D8813 --- .../storage/DifferentialTransaction.php | 2 +- .../PhabricatorApplicationTransactionEditor.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index 2a8aa23979..0f06e054d3 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -81,7 +81,7 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction { return ($this !== head($xactions)); } - return $this->shouldHide(); + return parent::shouldHideForMail($xactions); } public function getBodyForMail() { diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index dc033b6e35..57c5ab1fe0 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -1721,6 +1721,21 @@ abstract class PhabricatorApplicationTransactionEditor PhabricatorLiskDAO $object, array $xactions) { + // Check if any of the transactions are visible. If we don't have any + // visible transactions, don't send the mail. + + $any_visible = false; + foreach ($xactions as $xaction) { + if (!$xaction->shouldHideForMail($xactions)) { + $any_visible = true; + break; + } + } + + if (!$any_visible) { + return; + } + $email_to = array_filter(array_unique($this->getMailTo($object))); $email_cc = array_filter(array_unique($this->getMailCC($object)));