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

Give Pholio images a more modern initializer method

Summary: Depends on D19910. Ref T11351. Minor changes to make this behave in a more modern way.

Test Plan:
- Destroyed a mock.
- Lipsum'd a mock.
- Poked around, edited/viewed mocks.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T11351

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

+24 -16
+1 -1
src/applications/pholio/controller/PholioImageUploadController.php
··· 22 22 $title = $file->getName(); 23 23 } 24 24 25 - $image = id(new PholioImage()) 25 + $image = PholioImage::initializeNewImage() 26 26 ->attachFile($file) 27 27 ->setName($title) 28 28 ->setDescription($description)
+2 -2
src/applications/pholio/controller/PholioMockEditController.php
··· 140 140 $sequence = $sequence_map[$file_phid]; 141 141 142 142 if ($replaces_image_phid) { 143 - $replace_image = id(new PholioImage()) 143 + $replace_image = PholioImage::initializeNewImage() 144 144 ->setReplacesImagePHID($replaces_image_phid) 145 145 ->setFilePhid($file_phid) 146 146 ->attachFile($file) ··· 153 153 ->setNewValue($replace_image); 154 154 $posted_mock_images[] = $replace_image; 155 155 } else if (!$existing_image) { // this is an add 156 - $add_image = id(new PholioImage()) 156 + $add_image = PholioImage::initializeNewImage() 157 157 ->setFilePhid($file_phid) 158 158 ->attachFile($file) 159 159 ->setName(strlen($title) ? $title : $file->getName())
+5 -4
src/applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php
··· 41 41 $sequence = 0; 42 42 $images = array(); 43 43 foreach ($files as $file) { 44 - $image = new PholioImage(); 45 - $image->setFilePHID($file->getPHID()); 46 - $image->setSequence($sequence++); 47 - $image->attachMock($mock); 44 + $image = PholioImage::initializeNewImage() 45 + ->setFilePHID($file->getPHID()) 46 + ->setSequence($sequence++) 47 + ->attachMock($mock); 48 + 48 49 $images[] = $image; 49 50 } 50 51
+12 -6
src/applications/pholio/storage/PholioImage.php
··· 9 9 10 10 protected $mockID; 11 11 protected $filePHID; 12 - protected $name = ''; 13 - protected $description = ''; 12 + protected $name; 13 + protected $description; 14 14 protected $sequence; 15 - protected $isObsolete = 0; 15 + protected $isObsolete; 16 16 protected $replacesImagePHID = null; 17 17 18 18 private $inlineComments = self::ATTACHABLE; 19 19 private $file = self::ATTACHABLE; 20 20 private $mock = self::ATTACHABLE; 21 21 22 + public static function initializeNewImage() { 23 + return id(new self()) 24 + ->setName('') 25 + ->setDescription('') 26 + ->setIsObsolete(0); 27 + } 28 + 22 29 protected function getConfiguration() { 23 30 return array( 24 31 self::CONFIG_AUX_PHID => true, ··· 43 50 ) + parent::getConfiguration(); 44 51 } 45 52 46 - public function generatePHID() { 47 - return PhabricatorPHID::generateNewPHID(PholioImagePHIDType::TYPECONST); 53 + public function getPHIDType() { 54 + return PholioImagePHIDType::TYPECONST; 48 55 } 49 56 50 57 public function attachFile(PhabricatorFile $file) { ··· 66 73 $this->assertAttached($this->mock); 67 74 return $this->mock; 68 75 } 69 - 70 76 71 77 public function attachInlineComments(array $inline_comments) { 72 78 assert_instances_of($inline_comments, 'PholioTransactionComment');
+4 -3
src/applications/pholio/storage/PholioMock.php
··· 295 295 PhabricatorDestructionEngine $engine) { 296 296 297 297 $this->openTransaction(); 298 - $images = id(new PholioImage())->loadAllWhere( 299 - 'mockID = %d', 300 - $this->getID()); 298 + $images = id(new PholioImageQuery()) 299 + ->setViewer($engine->getViewer()) 300 + ->withMockIDs(array($this->getID())) 301 + ->execute(); 301 302 foreach ($images as $image) { 302 303 $image->delete(); 303 304 }