From 689eb11ff3d4056a1194bf3e838254d372562f7d Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 10 Apr 2011 14:36:04 -0700 Subject: [PATCH] Don't send a blank "COMMITS" field for mark-committed revisions. --- .../mail/comment/DifferentialCommentMail.php | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/applications/differential/mail/comment/DifferentialCommentMail.php b/src/applications/differential/mail/comment/DifferentialCommentMail.php index 6110d0ac8f..42eb8c7155 100644 --- a/src/applications/differential/mail/comment/DifferentialCommentMail.php +++ b/src/applications/differential/mail/comment/DifferentialCommentMail.php @@ -111,20 +111,22 @@ class DifferentialCommentMail extends DifferentialMail { $revision = $this->getRevision(); if ($revision->getStatus() == DifferentialRevisionStatus::COMMITTED) { $phids = $revision->loadCommitPHIDs(); - $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); - if (count($handles) == 1) { - $body[] = "COMMIT"; - } else { - // This is unlikely to ever happen since we'll send this mail the first - // time we discover a commit, but it's not impossible if data was - // migrated, etc. - $body[] = "COMMITS"; - } + if ($phids) { + $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); + if (count($handles) == 1) { + $body[] = "COMMIT"; + } else { + // This is unlikely to ever happen since we'll send this mail the + // first time we discover a commit, but it's not impossible if data + // was migrated, etc. + $body[] = "COMMITS"; + } - foreach ($handles as $handle) { - $body[] = ' '.PhabricatorEnv::getProductionURI($handle->getURI()); + foreach ($handles as $handle) { + $body[] = ' '.PhabricatorEnv::getProductionURI($handle->getURI()); + } + $body[] = null; } - $body[] = null; } return implode("\n", $body);