@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 82 lines 2.2 kB view raw
1<?php 2 3final class PhabricatorRepositoryAuditRequest 4 extends PhabricatorRepositoryDAO 5 implements PhabricatorPolicyInterface { 6 7 protected $auditorPHID; 8 protected $commitPHID; 9 protected $auditReasons = array(); 10 protected $auditStatus; 11 12 private $commit = self::ATTACHABLE; 13 14 protected function getConfiguration() { 15 return array( 16 self::CONFIG_TIMESTAMPS => false, 17 self::CONFIG_SERIALIZATION => array( 18 'auditReasons' => self::SERIALIZATION_JSON, 19 ), 20 self::CONFIG_COLUMN_SCHEMA => array( 21 'auditStatus' => 'text64', 22 ), 23 self::CONFIG_KEY_SCHEMA => array( 24 'commitPHID' => array( 25 'columns' => array('commitPHID'), 26 ), 27 'auditorPHID' => array( 28 'columns' => array('auditorPHID', 'auditStatus'), 29 ), 30 'key_unique' => array( 31 'columns' => array('commitPHID', 'auditorPHID'), 32 'unique' => true, 33 ), 34 ), 35 ) + parent::getConfiguration(); 36 } 37 38 public function isUser() { 39 $user_type = PhabricatorPeopleUserPHIDType::TYPECONST; 40 return (phid_get_type($this->getAuditorPHID()) == $user_type); 41 } 42 43 public function attachCommit(PhabricatorRepositoryCommit $commit) { 44 $this->commit = $commit; 45 return $this; 46 } 47 48 public function getCommit() { 49 return $this->assertAttached($this->commit); 50 } 51 52 public function isResigned() { 53 return $this->getAuditRequestStatusObject()->isResigned(); 54 } 55 56 public function getAuditRequestStatusObject() { 57 $status = $this->getAuditStatus(); 58 return PhabricatorAuditRequestStatus::newForStatus($status); 59 } 60 61/* -( PhabricatorPolicyInterface )----------------------------------------- */ 62 63 64 public function getCapabilities() { 65 return array( 66 PhabricatorPolicyCapability::CAN_VIEW, 67 ); 68 } 69 70 public function getPolicy($capability) { 71 return $this->getCommit()->getPolicy($capability); 72 } 73 74 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 75 return $this->getCommit()->hasAutomaticCapability($capability, $viewer); 76 } 77 78 public function describeAutomaticCapability($capability) { 79 return pht( 80 'This audit is attached to a commit, and inherits its policies.'); 81 } 82}