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

at recaptime-dev/main 60 lines 1.5 kB view raw
1<?php 2 3final class PhabricatorPasteRemarkupRule extends PhabricatorObjectRemarkupRule { 4 5 protected function getObjectNamePrefix() { 6 return 'P'; 7 } 8 9 protected function loadObjects(array $ids) { 10 $viewer = $this->getEngine()->getConfig('viewer'); 11 12 return id(new PhabricatorPasteQuery()) 13 ->setViewer($viewer) 14 ->withIDs($ids) 15 ->needContent(true) 16 ->execute(); 17 18 } 19 20 protected function renderObjectEmbed( 21 $object, 22 PhabricatorObjectHandle $handle, 23 $options) { 24 25 $embed_paste = id(new PasteEmbedView()) 26 ->setPaste($object) 27 ->setHandle($handle); 28 29 if (strlen($options)) { 30 $parser = new PhutilSimpleOptions(); 31 $opts = $parser->parse(substr($options, 1)); 32 33 foreach ($opts as $key => $value) { 34 if ($key == 'lines') { 35 $embed_paste->setLines(preg_replace('/[^0-9]/', '', $value)); 36 } else if ($key == 'highlight') { 37 $highlights = preg_split('/,|&/', preg_replace('/\s+/', '', $value)); 38 39 $to_highlight = array(); 40 foreach ($highlights as $highlight) { 41 $highlight = explode('-', $highlight); 42 43 if (!empty($highlight)) { 44 sort($highlight); 45 $to_highlight = array_merge( 46 $to_highlight, 47 range(head($highlight), last($highlight))); 48 } 49 } 50 51 $embed_paste->setHighlights(array_unique($to_highlight)); 52 } 53 } 54 55 } 56 57 return $embed_paste; 58 } 59 60}