Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / doorkeeper / engine / DoorkeeperFeedStoryPublisher.php
blob46ca3f3ac968f417efa72507402b62eb05730256
1 <?php
3 /**
4 * @task config Configuration
5 */
6 abstract class DoorkeeperFeedStoryPublisher extends Phobject {
8 private $feedStory;
9 private $viewer;
10 private $renderWithImpliedContext;
13 /* -( Configuration )------------------------------------------------------ */
16 /**
17 * Render story text using contextual language to identify the object the
18 * story is about, instead of the full object name. For example, without
19 * contextual language a story might render like this:
21 * alincoln created D123: Chop Wood for Log Cabin v2.0
23 * With contextual language, it will render like this instead:
25 * alincoln created this revision.
27 * If the interface where the text will be displayed is specific to an
28 * individual object (like Asana tasks that represent one review or commit
29 * are), it's generally more natural to use language that assumes context.
30 * If the target context may show information about several objects (like
31 * JIRA issues which can have several linked revisions), it's generally
32 * more useful not to assume context.
34 * @param bool True to assume object context when rendering.
35 * @return this
36 * @task config
38 public function setRenderWithImpliedContext($render_with_implied_context) {
39 $this->renderWithImpliedContext = $render_with_implied_context;
40 return $this;
43 /**
44 * Determine if rendering should assume object context. For discussion, see
45 * @{method:setRenderWithImpliedContext}.
47 * @return bool True if rendering should assume object context is implied.
48 * @task config
50 public function getRenderWithImpliedContext() {
51 return $this->renderWithImpliedContext;
54 public function setFeedStory(PhabricatorFeedStory $feed_story) {
55 $this->feedStory = $feed_story;
56 return $this;
59 public function getFeedStory() {
60 return $this->feedStory;
63 public function setViewer(PhabricatorUser $viewer) {
64 $this->viewer = $viewer;
65 return $this;
68 public function getViewer() {
69 return $this->viewer;
72 abstract public function canPublishStory(
73 PhabricatorFeedStory $story,
74 $object);
76 /**
77 * Hook for publishers to mutate the story object, particularly by loading
78 * and attaching additional data.
80 public function willPublishStory($object) {
81 return $object;
85 public function getStoryText($object) {
86 return $this->getFeedStory()->renderAsTextForDoorkeeper($this);
89 abstract public function isStoryAboutObjectCreation($object);
90 abstract public function isStoryAboutObjectClosure($object);
91 abstract public function getOwnerPHID($object);
92 abstract public function getActiveUserPHIDs($object);
93 abstract public function getPassiveUserPHIDs($object);
94 abstract public function getCCUserPHIDs($object);
95 abstract public function getObjectTitle($object);
96 abstract public function getObjectURI($object);
97 abstract public function getObjectDescription($object);
98 abstract public function isObjectClosed($object);
99 abstract public function getResponsibilityTitle($object);