public function loadPage()
 {
     $story_table = new PhabricatorFeedStoryData();
     $conn = $story_table->establishConnection('r');
     $data = queryfx_all($conn, 'SELECT story.* FROM %T story %Q %Q %Q %Q %Q', $story_table->getTableName(), $this->buildJoinClause($conn), $this->buildWhereClause($conn), $this->buildGroupClause($conn), $this->buildOrderClause($conn), $this->buildLimitClause($conn));
     $results = PhabricatorFeedStory::loadAllFromRows($data);
     return $this->processResults($results);
 }
 public function getRequiredHandlePHIDs()
 {
     $required_phids = parent::getRequiredHandlePHIDs();
     $from_phid = $this->getStoryData()->getValue('movedFromPHID');
     if ($from_phid) {
         $required_phids[] = $from_phid;
     }
     return $required_phids;
 }
 protected function loadPage()
 {
     $story_table = new PhabricatorFeedStoryData();
     $notification_table = new PhabricatorFeedStoryNotification();
     $conn = $story_table->establishConnection('r');
     $data = queryfx_all($conn, 'SELECT story.*, notif.hasViewed FROM %T notif
      JOIN %T story ON notif.chronologicalKey = story.chronologicalKey
      %Q
      ORDER BY notif.chronologicalKey DESC
      %Q', $notification_table->getTableName(), $story_table->getTableName(), $this->buildWhereClause($conn), $this->buildLimitClause($conn));
     $viewed_map = ipull($data, 'hasViewed', 'chronologicalKey');
     $stories = PhabricatorFeedStory::loadAllFromRows($data, $this->getViewer());
     foreach ($stories as $key => $story) {
         $story->setHasViewed($viewed_map[$key]);
     }
     return $stories;
 }
 public function execute()
 {
     if (!$this->userPHID) {
         throw new Exception("Call setUser() before executing the query");
     }
     $story_table = new PhabricatorFeedStoryData();
     $notification_table = new PhabricatorFeedStoryNotification();
     $conn = $story_table->establishConnection('r');
     $data = queryfx_all($conn, "SELECT story.*, notif.primaryObjectPHID, notif.hasViewed FROM %T notif\n         JOIN %T story ON notif.chronologicalKey = story.chronologicalKey\n         %Q\n         ORDER BY notif.chronologicalKey DESC\n         %Q", $notification_table->getTableName(), $story_table->getTableName(), $this->buildWhereClause($conn), $this->buildLimitClause($conn));
     $viewed_map = ipull($data, 'hasViewed', 'chronologicalKey');
     $primary_map = ipull($data, 'primaryObjectPHID', 'chronologicalKey');
     $stories = PhabricatorFeedStory::loadAllFromRows($data);
     foreach ($stories as $key => $story) {
         $story->setHasViewed($viewed_map[$key]);
         $story->setPrimaryObjectPHID($primary_map[$key]);
     }
     return $stories;
 }
 public function getRemarkupBodyForFeed(PhabricatorFeedStory $story)
 {
     $text = null;
     switch ($this->getTransactionType()) {
         case self::TYPE_TITLE:
             if ($this->getOldValue() === null) {
                 $post = $story->getPrimaryObject();
                 $text = $post->getBody();
             }
             break;
         case self::TYPE_VISIBILITY:
             if ($this->getNewValue() == PhameConstants::VISIBILITY_PUBLISHED) {
                 $post = $story->getPrimaryObject();
                 $text = $post->getBody();
             }
             break;
         case self::TYPE_BODY:
             $text = $this->getNewValue();
             break;
     }
     return $text;
 }
 public function getRemarkupBodyForFeed(PhabricatorFeedStory $story)
 {
     $text = null;
     switch ($this->getTransactionType()) {
         case self::TYPE_NAME:
             if ($this->getOldValue() === null) {
                 $mock = $story->getPrimaryObject();
                 $text = $mock->getDescription();
             }
             break;
         case self::TYPE_INLINE:
             $text = $this->getComment()->getContent();
             break;
     }
     return $text;
 }
Example #7
0
 public function getBodyForFeed(PhabricatorFeedStory $story)
 {
     $text = null;
     switch ($this->getTransactionType()) {
         case PholioTransactionType::TYPE_NAME:
             if ($this->getOldValue() === null) {
                 $mock = $story->getPrimaryObject();
                 $text = $mock->getDescription();
             }
             break;
         case PholioTransactionType::TYPE_INLINE:
             $text = $this->getComment()->getContent();
             break;
     }
     if ($text) {
         return phutil_escape_html_newlines(id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(128)->truncateString($text));
     }
     return parent::getBodyForFeed($story);
 }
 public function getBodyForFeed(PhabricatorFeedStory $story)
 {
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $body = null;
     switch ($this->getTransactionType()) {
         case PhabricatorTransactions::TYPE_COMMENT:
             $text = $this->getComment()->getContent();
             if (strlen($text)) {
                 $body = $story->getMarkupFieldOutput('comment/' . $this->getID());
             }
             break;
     }
     return $body;
 }
 public function getBodyForFeed(PhabricatorFeedStory $story)
 {
     $new = $this->getNewValue();
     $old = $this->getOldValue();
     $body = null;
     switch ($this->getTransactionType()) {
         case self::TYPE_TITLE:
             if ($old === null) {
                 $question = $story->getObject($this->getObjectPHID());
                 return phutil_escape_html_newlines(id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(128)->truncateString($question->getContent()));
             }
             break;
         case self::TYPE_ANSWERS:
             $answer = $this->getNewAnswerObject($story);
             if ($answer) {
                 return phutil_escape_html_newlines(id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(128)->truncateString($answer->getContent()));
             }
             break;
     }
     return parent::getBodyForFeed($story);
 }
 /**
  * Generally, the answer object is only available if the transaction
  * type is self::TYPE_ANSWERS.
  *
  * Some stories - notably ones made before D7027 - will be of the more
  * generic @{class:PhabricatorApplicationTransactionFeedStory}. These
  * poor stories won't have the PonderAnswer loaded, and thus will have
  * less cool information.
  */
 private function getNewAnswerObject(PhabricatorFeedStory $story)
 {
     if ($story instanceof PonderTransactionFeedStory) {
         $answer_phid = $this->getNewAnswerPHID();
         if ($answer_phid) {
             return $story->getObject($answer_phid);
         }
     }
     return null;
 }
 public function getBodyForFeed(PhabricatorFeedStory $story)
 {
     $text = null;
     switch ($this->getTransactionType()) {
         case self::TYPE_TITLE:
             if ($this->getOldValue() === null) {
                 $post = $story->getPrimaryObject();
                 $text = $post->getBody();
             }
             break;
         case self::TYPE_VISIBILITY:
             if ($this->getNewValue() == PhameConstants::VISIBILITY_PUBLISHED) {
                 $post = $story->getPrimaryObject();
                 $text = $post->getBody();
             }
             break;
         case self::TYPE_BODY:
             $text = $this->getNewValue();
             break;
     }
     if (strlen($text)) {
         return phutil_escape_html_newlines(id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(128)->truncateString($text));
     }
     return parent::getBodyForFeed($story);
 }
 public function getBodyForFeed(PhabricatorFeedStory $story)
 {
     switch ($this->getTransactionType()) {
         case self::TYPE_COMMIT:
             $data = $this->getNewValue();
             return $story->renderSummary($data['summary']);
     }
     return parent::getBodyForFeed($story);
 }
 protected function willFilterPage(array $data)
 {
     return PhabricatorFeedStory::loadAllFromRows($data, $this->getViewer());
 }