mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Repositories - don't send emails or publish feed stories about commits from importing repositories
Summary: ...also truncate authorName to 255 so that we don't get database errors. Ref T6350. Test Plan: see T6350 - mostly doing it live - but I did sanity check and commit something and it worked! Reviewers: epriestley, chad Reviewed By: chad Subscribers: Korvin, epriestley Maniphest Tasks: T6350 Differential Revision: https://secure.phabricator.com/D10734
This commit is contained in:
parent
d248bc47cf
commit
3bf770cb30
3 changed files with 17 additions and 4 deletions
|
@ -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(
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue