[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DifferentialDoorkeeperRevisionFeedStoryPublisher 4 extends DoorkeeperFeedStoryPublisher { 5 6 public function canPublishStory(PhabricatorFeedStory $story, $object) { 7 return ($object instanceof DifferentialRevision); 8 } 9 10 public function isStoryAboutObjectCreation($object) { 11 $story = $this->getFeedStory(); 12 $action = $story->getStoryData()->getValue('action'); 13 14 return ($action == DifferentialAction::ACTION_CREATE); 15 } 16 17 public function isStoryAboutObjectClosure($object) { 18 $story = $this->getFeedStory(); 19 $action = $story->getStoryData()->getValue('action'); 20 21 return ($action == DifferentialAction::ACTION_CLOSE) || 22 ($action == DifferentialAction::ACTION_ABANDON); 23 } 24 25 public function willPublishStory($object) { 26 return id(new DifferentialRevisionQuery()) 27 ->setViewer($this->getViewer()) 28 ->withIDs(array($object->getID())) 29 ->needRelationships(true) 30 ->executeOne(); 31 } 32 33 public function getOwnerPHID($object) { 34 return $object->getAuthorPHID(); 35 } 36 37 public function getActiveUserPHIDs($object) { 38 $status = $object->getStatus(); 39 if ($status == ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) { 40 return $object->getReviewers(); 41 } else { 42 return array(); 43 } 44 } 45 46 public function getPassiveUserPHIDs($object) { 47 $status = $object->getStatus(); 48 if ($status == ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) { 49 return array(); 50 } else { 51 return $object->getReviewers(); 52 } 53 } 54 55 public function getCCUserPHIDs($object) { 56 return $object->getCCPHIDs(); 57 } 58 59 public function getObjectTitle($object) { 60 $prefix = $this->getTitlePrefix($object); 61 62 $lines = new PhutilNumber($object->getLineCount()); 63 $lines = pht('[Request, %d lines]', $lines); 64 65 $id = $object->getID(); 66 67 $title = $object->getTitle(); 68 69 return ltrim("{$prefix} {$lines} D{$id}: {$title}"); 70 } 71 72 public function getObjectURI($object) { 73 return PhabricatorEnv::getProductionURI('/D'.$object->getID()); 74 } 75 76 public function getObjectDescription($object) { 77 return $object->getSummary(); 78 } 79 80 public function isObjectClosed($object) { 81 return $object->isClosed(); 82 } 83 84 public function getResponsibilityTitle($object) { 85 $prefix = $this->getTitlePrefix($object); 86 return pht('%s Review Request', $prefix); 87 } 88 89 private function getTitlePrefix(DifferentialRevision $revision) { 90 $prefix_key = 'metamta.differential.subject-prefix'; 91 return PhabricatorEnv::getEnvConfig($prefix_key); 92 } 93 94 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |