diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index 68ba13a513..5d3bc3d881 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -522,6 +522,14 @@ final class PhabricatorAuditEditor protected function shouldSendMail( PhabricatorLiskDAO $object, array $xactions) { + + // not every code path loads the repository so tread carefully + if ($object->getRepository($assert_attached = false)) { + $repository = $object->getRepository(); + if ($repository->isImporting()) { + return false; + } + } return $this->isCommitMostlyImported($object); } @@ -803,7 +811,7 @@ final class PhabricatorAuditEditor protected function shouldPublishFeedStory( PhabricatorLiskDAO $object, array $xactions) { - return $this->isCommitMostlyImported($object); + return $this->shouldSendMail($object, $xactions); } protected function shouldApplyHeraldRules( diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php index eab247497f..782bc018d3 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php +++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php @@ -40,8 +40,11 @@ final class PhabricatorRepositoryCommit return $this; } - public function getRepository() { - return $this->assertAttached($this->repository); + public function getRepository($assert_attached = true) { + if ($assert_attached) { + return $this->assertAttached($this->repository); + } + return $this->repository; } public function isPartiallyImported($mask) { diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php index b9d2a39125..7c56251dea 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php @@ -17,7 +17,9 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker $data = new PhabricatorRepositoryCommitData(); } $data->setCommitID($commit->getID()); - $data->setAuthorName((string)$author); + $data->setAuthorName(id(new PhutilUTF8StringTruncator()) + ->setMaximumCodepoints(255) + ->truncateString((string)$author)); $data->setCommitDetail('authorName', $ref->getAuthorName()); $data->setCommitDetail('authorEmail', $ref->getAuthorEmail());