@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.

Fix bin/lipsum

Summary:
- Set a default edit policy to match view policy for projects
- It seems like initializeNew* is a better init function than new Phabricator*,
so ported two classes to use it and spot-checked the others (this also fixed
a fatal.)
- Other minor bugs

Test Plan: Ran lipsum for a while without any fatals

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, jhurwitz, Korvin

Differential Revision: https://secure.phabricator.com/D13559

authored by

Mihir Kedia and committed by
epriestley
6a3c1ba0 6d404c82

+13 -9
+4 -3
src/applications/paste/lipsum/PhabricatorPasteTestDataGenerator.php
··· 10 10 ); 11 11 12 12 public function generate() { 13 - $authorphid = $this->loadPhabrictorUserPHID(); 13 + $author = $this->loadPhabrictorUser(); 14 + $authorphid = $author->getPHID(); 14 15 $language = $this->generateLanguage(); 15 16 $content = $this->generateContent($language); 16 17 $title = $this->generateTitle($language); ··· 24 25 $policy = $this->generatePolicy(); 25 26 $filephid = $paste_file->getPHID(); 26 27 $parentphid = $this->loadPhabrictorPastePHID(); 27 - $paste = id(new PhabricatorPaste()) 28 + $paste = PhabricatorPaste::initializeNewPaste($author) 28 29 ->setParentPHID($parentphid) 29 - ->setAuthorPHID($authorphid) 30 30 ->setTitle($title) 31 31 ->setLanguage($language) 32 32 ->setViewPolicy($policy) 33 + ->setEditPolicy($policy) 33 34 ->setFilePHID($filephid) 34 35 ->save(); 35 36 return $paste;
+5 -1
src/applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php
··· 92 92 $quantity = min($quantity, count($images)); 93 93 94 94 if ($quantity) { 95 - foreach (array_rand($images, $quantity) as $random) { 95 + $random_images = $quantity === 1 ? 96 + array(array_rand($images, $quantity)) : 97 + array_rand($images, $quantity); 98 + 99 + foreach ($random_images as $random) { 96 100 $rand_images[] = $images[$random]->getPHID(); 97 101 } 98 102 }
+4 -5
src/applications/project/lipsum/PhabricatorProjectTestDataGenerator.php
··· 9 9 $title = $this->generateTitle(); 10 10 $author = $this->loadPhabrictorUser(); 11 11 $author_phid = $author->getPHID(); 12 - $project = id(new PhabricatorProject()) 13 - ->setName($title) 14 - ->setAuthorPHID($author_phid); 12 + $project = PhabricatorProject::initializeNewProject($author) 13 + ->setName($title); 15 14 16 15 $this->addTransaction( 17 16 PhabricatorProjectTransaction::TYPE_NAME, 18 17 $title); 19 - $this->addTransaction( 20 - PhabricatorProjectTransaction::TYPE_MEMBERS, 18 + $project->attachMemberPHIDs( 21 19 $this->loadMembersWithAuthor($author_phid)); 22 20 $this->addTransaction( 23 21 PhabricatorProjectTransaction::TYPE_STATUS, ··· 35 33 $editor = id(new PhabricatorProjectTransactionEditor()) 36 34 ->setActor($author) 37 35 ->setContentSource(PhabricatorContentSource::newConsoleSource()) 36 + ->setContinueOnNoEffect(true) 38 37 ->applyTransactions($project, $this->xactions); 39 38 40 39 return $project->save();