@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 99 lines 2.6 kB view raw
1<?php 2 3final class PhabricatorRepositorySyncEvent 4 extends PhabricatorRepositoryDAO 5 implements PhabricatorPolicyInterface { 6 7 protected $repositoryPHID; 8 protected $epoch; 9 protected $devicePHID; 10 protected $fromDevicePHID; 11 protected $deviceVersion; 12 protected $fromDeviceVersion; 13 protected $resultType; 14 protected $resultCode; 15 protected $syncWait; 16 protected $properties = array(); 17 18 private $repository = self::ATTACHABLE; 19 20 const RESULT_SYNC = 'sync'; 21 const RESULT_ERROR = 'error'; 22 const RESULT_TIMEOUT = 'timeout'; 23 const RESULT_EXCEPTION = 'exception'; 24 25 public static function initializeNewEvent() { 26 return new self(); 27 } 28 29 protected function getConfiguration() { 30 return array( 31 self::CONFIG_AUX_PHID => true, 32 self::CONFIG_TIMESTAMPS => false, 33 self::CONFIG_SERIALIZATION => array( 34 'properties' => self::SERIALIZATION_JSON, 35 ), 36 self::CONFIG_COLUMN_SCHEMA => array( 37 'deviceVersion' => 'uint32?', 38 'fromDeviceVersion' => 'uint32?', 39 'resultType' => 'text32', 40 'resultCode' => 'uint32', 41 'syncWait' => 'uint64', 42 ), 43 self::CONFIG_KEY_SCHEMA => array( 44 'key_repository' => array( 45 'columns' => array('repositoryPHID'), 46 ), 47 'key_epoch' => array( 48 'columns' => array('epoch'), 49 ), 50 ), 51 ) + parent::getConfiguration(); 52 } 53 54 public function getPHIDType() { 55 return PhabricatorRepositorySyncEventPHIDType::TYPECONST; 56 } 57 58 public function attachRepository(PhabricatorRepository $repository) { 59 $this->repository = $repository; 60 return $this; 61 } 62 63 public function getRepository() { 64 return $this->assertAttached($this->repository); 65 } 66 67 public function setProperty($key, $value) { 68 $this->properties[$key] = $value; 69 return $this; 70 } 71 72 public function getProperty($key, $default = null) { 73 return idx($this->properties, $key, $default); 74 } 75 76/* -( PhabricatorPolicyInterface )----------------------------------------- */ 77 78 79 public function getCapabilities() { 80 return array( 81 PhabricatorPolicyCapability::CAN_VIEW, 82 ); 83 } 84 85 public function getPolicy($capability) { 86 return $this->getRepository()->getPolicy($capability); 87 } 88 89 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 90 return $this->getRepository()->hasAutomaticCapability($capability, $viewer); 91 } 92 93 public function describeAutomaticCapability($capability) { 94 return pht( 95 "A repository's sync events are visible to users who can see the ". 96 "repository."); 97 } 98 99}