@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 upstream/main 64 lines 1.6 kB view raw
1<?php 2 3abstract class PhabricatorProjectsBasePolicyRule 4 extends PhabricatorPolicyRule { 5 6 private $memberships = array(); 7 8 protected function getMemberships($viewer_phid) { 9 return idx($this->memberships, $viewer_phid, array()); 10 } 11 12 public function willApplyRules( 13 PhabricatorUser $viewer, 14 array $values, 15 array $objects) { 16 17 $values = array_unique(array_filter(array_mergev($values))); 18 if (!$values) { 19 return; 20 } 21 22 $projects = id(new PhabricatorProjectQuery()) 23 ->setViewer(PhabricatorUser::getOmnipotentUser()) 24 ->withMemberPHIDs(array($viewer->getPHID())) 25 ->withPHIDs($values) 26 ->execute(); 27 foreach ($projects as $project) { 28 $this->memberships[$viewer->getPHID()][$project->getPHID()] = true; 29 } 30 } 31 32 public function getValueControlType() { 33 return self::CONTROL_TYPE_TOKENIZER; 34 } 35 36 public function getValueControlTemplate() { 37 $datasource = id(new PhabricatorProjectDatasource()) 38 ->setParameters( 39 array( 40 'policy' => 1, 41 )); 42 43 return $this->getDatasourceTemplate($datasource); 44 } 45 46 public function getValueForStorage($value) { 47 PhutilTypeSpec::newFromString('list<string>')->check($value); 48 return array_values($value); 49 } 50 51 public function getValueForDisplay(PhabricatorUser $viewer, $value) { 52 $handles = id(new PhabricatorHandleQuery()) 53 ->setViewer($viewer) 54 ->withPHIDs($value) 55 ->execute(); 56 57 return mpull($handles, 'getFullName', 'getPHID'); 58 } 59 60 public function ruleHasEffect($value) { 61 return (bool)$value; 62 } 63 64}