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

Use transaction diffs to show description changes in Pholio

Summary: Fixes T2659. These didn't exist until recently.

Test Plan: {F34556}

Reviewers: chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T2659

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

+33 -12
+2 -4
src/applications/config/storage/PhabricatorConfigTransaction.php
··· 85 85 if ($old['deleted']) { 86 86 $old_text = ''; 87 87 } else { 88 - // NOTE: Here and below, we're adding a synthetic "\n" to prevent the 89 - // differ from complaining about missing trailing newlines. 90 - $old_text = PhabricatorConfigJSON::prettyPrintJSON($old['value'])."\n"; 88 + $old_text = PhabricatorConfigJSON::prettyPrintJSON($old['value']); 91 89 } 92 90 93 91 if ($new['deleted']) { 94 92 $new_text = ''; 95 93 } else { 96 - $new_text = PhabricatorConfigJSON::prettyPrintJSON($new['value'])."\n"; 94 + $new_text = PhabricatorConfigJSON::prettyPrintJSON($new['value']); 97 95 } 98 96 99 97 $view = id(new PhabricatorApplicationTransactionTextDiffDetailView())
+22 -4
src/applications/pholio/storage/PholioTransaction.php
··· 49 49 break; 50 50 case PholioTransactionType::TYPE_DESCRIPTION: 51 51 return pht( 52 - '%s updated the description of this mock. '. 53 - 'The old description was: %s', 54 - $this->renderHandleLink($author_phid), 55 - $old); 52 + "%s updated the mock's description.", 53 + $this->renderHandleLink($author_phid)); 56 54 break; 57 55 case PholioTransactionType::TYPE_INLINE: 58 56 return pht( ··· 61 59 } 62 60 63 61 return parent::getTitle(); 62 + } 63 + 64 + public function hasChangeDetails() { 65 + switch ($this->getTransactionType()) { 66 + case PholioTransactionType::TYPE_DESCRIPTION: 67 + return true; 68 + } 69 + return parent::hasChangeDetails(); 70 + } 71 + 72 + public function renderChangeDetails(PhabricatorUser $viewer) { 73 + $old = $this->getOldValue(); 74 + $new = $this->getNewValue(); 75 + 76 + $view = id(new PhabricatorApplicationTransactionTextDiffDetailView()) 77 + ->setUser($viewer) 78 + ->setOldText($old) 79 + ->setNewText($new); 80 + 81 + return $view->render(); 64 82 } 65 83 66 84
+9 -4
src/applications/transactions/view/PhabricatorApplicationTransactionTextDiffDetailView.php
··· 23 23 // TODO: On mobile, or perhaps by default, we should switch to 1-up once 24 24 // that is built. 25 25 26 - $old = phutil_utf8_hard_wrap($old, 80); 27 - $old = implode("\n", $old); 28 - $new = phutil_utf8_hard_wrap($new, 80); 29 - $new = implode("\n", $new); 26 + if (strlen($old)) { 27 + $old = phutil_utf8_hard_wrap($old, 80); 28 + $old = implode("\n", $old)."\n"; 29 + } 30 + 31 + if (strlen($new)) { 32 + $new = phutil_utf8_hard_wrap($new, 80); 33 + $new = implode("\n", $new)."\n"; 34 + } 30 35 31 36 $engine = new PhabricatorDifferenceEngine(); 32 37 $changeset = $engine->generateChangesetFromFileContent($old, $new);