@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 file attach bug in Macro

Summary: This was mis-tested by only using one account, which could always see the image. External transaction moved file attachment to the modular transaction for file and audio instead.

Test Plan: Test adding audio and a macro on a pleb account, visit with normal account and see macro fine.

Reviewers: epriestley, amckinley

Reviewed By: amckinley

Subscribers: Korvin

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

+57 -39
+1 -1
src/applications/macro/editor/PhabricatorMacroEditEngine.php
··· 6 6 const ENGINECONST = 'macro.image'; 7 7 8 8 public function getEngineName() { 9 - return pht('Macro Imagea'); 9 + return pht('Macro Image'); 10 10 } 11 11 12 12 public function getSummaryHeader() {
-38
src/applications/macro/editor/PhabricatorMacroEditor.php
··· 19 19 return pht('%s created %s.', $author, $object); 20 20 } 21 21 22 - protected function applyCustomExternalTransaction( 23 - PhabricatorLiskDAO $object, 24 - PhabricatorApplicationTransaction $xaction) { 25 - 26 - switch ($xaction->getTransactionType()) { 27 - case PhabricatorMacroFileTransaction::TRANSACTIONTYPE: 28 - case PhabricatorMacroAudioTransaction::TRANSACTIONTYPE: 29 - // When changing a macro's image or audio, attach the underlying files 30 - // to the macro (and detach the old files). 31 - $old = $xaction->getOldValue(); 32 - $new = $xaction->getNewValue(); 33 - $all = array(); 34 - if ($old) { 35 - $all[] = $old; 36 - } 37 - if ($new) { 38 - $all[] = $new; 39 - } 40 - 41 - $files = id(new PhabricatorFileQuery()) 42 - ->setViewer($this->requireActor()) 43 - ->withPHIDs($all) 44 - ->execute(); 45 - $files = mpull($files, null, 'getPHID'); 46 - 47 - $old_file = idx($files, $old); 48 - if ($old_file) { 49 - $old_file->detachFromObject($object->getPHID()); 50 - } 51 - 52 - $new_file = idx($files, $new); 53 - if ($new_file) { 54 - $new_file->attachToObject($object->getPHID()); 55 - } 56 - break; 57 - } 58 - } 59 - 60 22 protected function shouldSendMail( 61 23 PhabricatorLiskDAO $object, 62 24 array $xactions) {
+28
src/applications/macro/xaction/PhabricatorMacroAudioTransaction.php
··· 13 13 $object->setAudioPHID($value); 14 14 } 15 15 16 + public function applyExternalEffects($object, $value) { 17 + $old = $this->generateOldValue($object); 18 + $new = $value; 19 + $all = array(); 20 + if ($old) { 21 + $all[] = $old; 22 + } 23 + if ($new) { 24 + $all[] = $new; 25 + } 26 + 27 + $files = id(new PhabricatorFileQuery()) 28 + ->setViewer($this->getActor()) 29 + ->withPHIDs($all) 30 + ->execute(); 31 + $files = mpull($files, null, 'getPHID'); 32 + 33 + $old_file = idx($files, $old); 34 + if ($old_file) { 35 + $old_file->detachFromObject($object->getPHID()); 36 + } 37 + 38 + $new_file = idx($files, $new); 39 + if ($new_file) { 40 + $new_file->attachToObject($object->getPHID()); 41 + } 42 + } 43 + 16 44 public function getTitle() { 17 45 $new = $this->getNewValue(); 18 46 $old = $this->getOldValue();
+28
src/applications/macro/xaction/PhabricatorMacroFileTransaction.php
··· 13 13 $object->setFilePHID($value); 14 14 } 15 15 16 + public function applyExternalEffects($object, $value) { 17 + $old = $this->generateOldValue($object); 18 + $new = $value; 19 + $all = array(); 20 + if ($old) { 21 + $all[] = $old; 22 + } 23 + if ($new) { 24 + $all[] = $new; 25 + } 26 + 27 + $files = id(new PhabricatorFileQuery()) 28 + ->setViewer($this->getActor()) 29 + ->withPHIDs($all) 30 + ->execute(); 31 + $files = mpull($files, null, 'getPHID'); 32 + 33 + $old_file = idx($files, $old); 34 + if ($old_file) { 35 + $old_file->detachFromObject($object->getPHID()); 36 + } 37 + 38 + $new_file = idx($files, $new); 39 + if ($new_file) { 40 + $new_file->attachToObject($object->getPHID()); 41 + } 42 + } 43 + 16 44 public function getTitle() { 17 45 return pht( 18 46 '%s changed the image for this macro.',