@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 the feed line items for autodetect paste languages

Summary:
Fixes T11555. Previously changing the extension of a paste wouldn't change the syntax highlight language. Now it does.
Also, feed items involving autodetect weren't rendering in a readable way.

Test Plan: Created a paste named `paste.php` and let it autodetect language. Then edited the paste to be named paste.rainbow. It should now be highlighted in raiinnboow

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley, yelirekim

Maniphest Tasks: T11555

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

Josh Cox f5537fdf 5504f37e

+14 -4
+2
src/applications/paste/query/PhabricatorPasteQuery.php
··· 173 173 'P'.$paste->getID(), 174 174 $paste->getFilePHID(), 175 175 $paste->getLanguage(), 176 + PhabricatorHash::digestForIndex($paste->getTitle()), 176 177 )); 177 178 } 178 179 ··· 184 185 $paste->getFilePHID(), 185 186 $paste->getLanguage(), 186 187 'snippet', 188 + PhabricatorHash::digestForIndex($paste->getTitle()), 187 189 )); 188 190 } 189 191
+12 -4
src/applications/paste/xaction/PhabricatorPasteLanguageTransaction.php
··· 13 13 $object->setLanguage($value); 14 14 } 15 15 16 + private function renderLanguageValue($value) { 17 + if (!strlen($value)) { 18 + return $this->renderValue(pht('autodetect')); 19 + } else { 20 + return $this->renderValue($value); 21 + } 22 + } 23 + 16 24 public function getTitle() { 17 25 return pht( 18 26 "%s updated the paste's language from %s to %s.", 19 27 $this->renderAuthor(), 20 - $this->renderOldValue(), 21 - $this->renderNewValue()); 28 + $this->renderLanguageValue($this->getOldValue()), 29 + $this->renderLanguageValue($this->getNewValue())); 22 30 } 23 31 24 32 public function getTitleForFeed() { ··· 26 34 '%s updated the language for %s from %s to %s.', 27 35 $this->renderAuthor(), 28 36 $this->renderObject(), 29 - $this->renderOldValue(), 30 - $this->renderNewValue()); 37 + $this->renderLanguageValue($this->getOldValue()), 38 + $this->renderLanguageValue($this->getNewValue())); 31 39 } 32 40 33 41 }