@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+17 -4
+9 -1
src/applications/audit/editor/PhabricatorAuditEditor.php
··· 522 522 protected function shouldSendMail( 523 523 PhabricatorLiskDAO $object, 524 524 array $xactions) { 525 + 526 + // not every code path loads the repository so tread carefully 527 + if ($object->getRepository($assert_attached = false)) { 528 + $repository = $object->getRepository(); 529 + if ($repository->isImporting()) { 530 + return false; 531 + } 532 + } 525 533 return $this->isCommitMostlyImported($object); 526 534 } 527 535 ··· 803 811 protected function shouldPublishFeedStory( 804 812 PhabricatorLiskDAO $object, 805 813 array $xactions) { 806 - return $this->isCommitMostlyImported($object); 814 + return $this->shouldSendMail($object, $xactions); 807 815 } 808 816 809 817 protected function shouldApplyHeraldRules(
+5 -2
src/applications/repository/storage/PhabricatorRepositoryCommit.php
··· 40 40 return $this; 41 41 } 42 42 43 - public function getRepository() { 44 - return $this->assertAttached($this->repository); 43 + public function getRepository($assert_attached = true) { 44 + if ($assert_attached) { 45 + return $this->assertAttached($this->repository); 46 + } 47 + return $this->repository; 45 48 } 46 49 47 50 public function isPartiallyImported($mask) {
+3 -1
src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
··· 17 17 $data = new PhabricatorRepositoryCommitData(); 18 18 } 19 19 $data->setCommitID($commit->getID()); 20 - $data->setAuthorName((string)$author); 20 + $data->setAuthorName(id(new PhutilUTF8StringTruncator()) 21 + ->setMaximumCodepoints(255) 22 + ->truncateString((string)$author)); 21 23 22 24 $data->setCommitDetail('authorName', $ref->getAuthorName()); 23 25 $data->setCommitDetail('authorEmail', $ref->getAuthorEmail());