@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 92 lines 2.1 kB view raw
1<?php 2 3final class PhabricatorNamedQueryConfig 4 extends PhabricatorSearchDAO 5 implements PhabricatorPolicyInterface { 6 7 protected $engineClassName; 8 protected $scopePHID; 9 protected $properties = array(); 10 11 const SCOPE_GLOBAL = 'scope.global'; 12 13 const PROPERTY_PINNED = 'pinned'; 14 15 protected function getConfiguration() { 16 return array( 17 self::CONFIG_SERIALIZATION => array( 18 'properties' => self::SERIALIZATION_JSON, 19 ), 20 self::CONFIG_COLUMN_SCHEMA => array( 21 'engineClassName' => 'text128', 22 ), 23 self::CONFIG_KEY_SCHEMA => array( 24 'key_scope' => array( 25 'columns' => array('engineClassName', 'scopePHID'), 26 'unique' => true, 27 ), 28 ), 29 ) + parent::getConfiguration(); 30 } 31 32 public static function initializeNewQueryConfig() { 33 return new self(); 34 } 35 36 public function isGlobal() { 37 return ($this->getScopePHID() == self::SCOPE_GLOBAL); 38 } 39 40 public function getConfigProperty($key, $default = null) { 41 return idx($this->properties, $key, $default); 42 } 43 44 public function setConfigProperty($key, $value) { 45 $this->properties[$key] = $value; 46 return $this; 47 } 48 49 public function getStrengthSortVector() { 50 // Apply personal preferences before global preferences. 51 if (!$this->isGlobal()) { 52 $phase = 0; 53 } else { 54 $phase = 1; 55 } 56 57 return id(new PhutilSortVector()) 58 ->addInt($phase) 59 ->addInt($this->getID()); 60 } 61 62 63/* -( PhabricatorPolicyInterface )----------------------------------------- */ 64 65 66 public function getCapabilities() { 67 return array( 68 PhabricatorPolicyCapability::CAN_VIEW, 69 ); 70 } 71 72 public function getPolicy($capability) { 73 return PhabricatorPolicies::POLICY_NOONE; 74 } 75 76 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 77 if ($this->isGlobal()) { 78 return true; 79 } 80 81 if ($viewer->getPHID() == $this->getScopePHID()) { 82 return true; 83 } 84 85 return false; 86 } 87 88 public function describeAutomaticCapability($capability) { 89 return null; 90 } 91 92}