public function renderView()
 {
     $data = $this->getStoryData();
     $view = new PhabricatorFeedStoryView();
     $view->setTitle('Unknown Story');
     $view->setEpoch($data->getEpoch());
     $view->appendChild('This is an unrenderable feed story of type ' . '"' . phutil_escape_html($data->getStoryType()) . '".');
     return $view;
 }
 public function renderView()
 {
     $data = $this->getStoryData();
     $view = new PhabricatorFeedStoryView();
     $type = $data->getValue('type');
     $old = $data->getValue('old');
     $new = $data->getValue('new');
     $proj_phid = $data->getValue('projectPHID');
     $author_phid = $data->getAuthorPHID();
     switch ($type) {
         case PhabricatorProjectTransactionType::TYPE_NAME:
             if (strlen($old)) {
                 $action = 'renamed project ' . $this->linkTo($proj_phid) . ' from ' . $this->renderString($old) . ' to ' . $this->renderString($new) . '.';
             } else {
                 $action = 'created project ' . $this->linkTo($proj_phid) . ' (as ' . $this->renderString($new) . ').';
             }
             break;
         case PhabricatorProjectTransactionType::TYPE_STATUS:
             $action = 'changed project ' . $this->linkTo($proj_phid) . ' status from ' . $this->renderString(PhabricatorProjectStatus::getNameForStatus($old)) . ' to ' . $this->renderString(PhabricatorProjectStatus::getNameForStatus($new)) . '.';
             break;
         case PhabricatorProjectTransactionType::TYPE_MEMBERS:
             $add = array_diff($new, $old);
             $rem = array_diff($old, $new);
             if (count($add) == 1 && count($rem) == 0 && head($add) == $author_phid) {
                 $action = 'joined project ' . $this->linkTo($proj_phid) . '.';
             } else {
                 if (count($add) == 0 && count($rem) == 1 && head($rem) == $author_phid) {
                     $action = 'left project ' . $this->linkTo($proj_phid) . '.';
                 } else {
                     if (empty($rem)) {
                         $action = 'added members to project ' . $this->linkTo($proj_phid) . ': ' . $this->renderHandleList($add) . '.';
                     } else {
                         if (empty($add)) {
                             $action = 'removed members from project ' . $this->linkTo($proj_phid) . ': ' . $this->renderHandleList($rem) . '.';
                         } else {
                             $action = 'changed members of project ' . $this->linkTo($proj_phid) . ', added: ' . $this->renderHandleList($add) . '; removed: ' . $this->renderHandleList($rem) . '.';
                         }
                     }
                 }
             }
             break;
         default:
             $action = 'updated project ' . $this->linkTo($proj_phid) . '.';
             break;
     }
     $view->setTitle($this->linkTo($author_phid) . ' ' . $action);
     $view->setOneLineStory(true);
     return $view;
 }
 public function renderView()
 {
     $data = $this->getStoryData();
     $view = new PhabricatorFeedStoryView();
     $line = $this->getLineForData($data);
     $view->setTitle($line);
     $view->setEpoch($data->getEpoch());
     $action = $data->getValue('action');
     switch ($action) {
         case DifferentialAction::ACTION_CREATE:
         case DifferentialAction::ACTION_CLOSE:
             $full_size = true;
             break;
         default:
             $full_size = false;
             break;
     }
     if ($full_size) {
         $view->setImage($this->getHandle($data->getAuthorPHID())->getImageURI());
         $content = $this->renderSummary($data->getValue('feedback_content'));
         $view->appendChild($content);
     } else {
         $view->setOneLineStory(true);
     }
     return $view;
 }
 public function renderView()
 {
     $data = $this->getStoryData();
     $author_phid = $data->getAuthorPHID();
     $document_phid = $data->getValue('phid');
     $view = new PhabricatorFeedStoryView();
     $action = $data->getValue('action');
     $verb = PhrictionActionConstants::getActionPastTenseVerb($action);
     $view->setTitle($this->linkTo($author_phid) . " {$verb} the document " . $this->linkTo($document_phid) . '.');
     $view->setEpoch($data->getEpoch());
     $action = $data->getValue('action');
     switch ($action) {
         case PhrictionActionConstants::ACTION_CREATE:
             $full_size = true;
             break;
         default:
             $full_size = false;
             break;
     }
     if ($full_size) {
         $view->setImage($this->getHandle($author_phid)->getImageURI());
         $content = $this->renderSummary($data->getValue('content'));
         $view->appendChild($content);
     } else {
         $view->setOneLineStory(true);
     }
     return $view;
 }
 public function renderView()
 {
     $data = $this->getStoryData();
     $author_phid = $data->getAuthorPHID();
     $view = new PhabricatorFeedStoryView();
     $revision_phid = $data->getValue('revision_phid');
     $action = $data->getValue('action');
     $verb = DifferentialAction::getActionPastTenseVerb($action);
     $view->setTitle($this->linkTo($author_phid) . " {$verb} revision " . $this->linkTo($revision_phid) . '.');
     $view->setEpoch($data->getEpoch());
     $action = $data->getValue('action');
     switch ($action) {
         case DifferentialAction::ACTION_CREATE:
         case DifferentialAction::ACTION_COMMIT:
             $full_size = true;
             break;
         default:
             $full_size = false;
             break;
     }
     if ($full_size) {
         $view->setImage($this->getHandle($author_phid)->getImageURI());
         $content = $this->renderSummary($data->getValue('feedback_content'));
         $view->appendChild($content);
     } else {
         $view->setOneLineStory(true);
     }
     return $view;
 }
 public function renderView()
 {
     $data = $this->getStoryData();
     $author_phid = $data->getAuthorPHID();
     $commit_phid = $data->getValue('commitPHID');
     $view = new PhabricatorFeedStoryView();
     $action = $data->getValue('action');
     $verb = PhabricatorAuditActionConstants::getActionPastTenseVerb($action);
     $view->setTitle($this->linkTo($author_phid) . " {$verb} commit " . $this->linkTo($commit_phid) . ".");
     $view->setEpoch($data->getEpoch());
     $comments = $data->getValue('content');
     if ($comments) {
         $full_size = true;
     } else {
         $full_size = false;
     }
     if ($full_size) {
         $view->setImage($this->getHandle($author_phid)->getImageURI());
         $content = $this->renderSummary($data->getValue('content'));
         $view->appendChild($content);
     } else {
         $view->setOneLineStory(true);
     }
     return $view;
 }
 public function renderView()
 {
     $data = $this->getStoryData();
     $handles = $this->getHandles();
     $author_phid = $data->getAuthorPHID();
     $document_phid = $data->getValue('phid');
     $objects = $this->getObjects();
     $view = new PhabricatorFeedStoryView();
     $action = $data->getValue('action');
     $verb = PhrictionActionConstants::getActionPastTenseVerb($action);
     $view->setTitle('<strong>' . $handles[$author_phid]->renderLink() . '</strong>' . ' ' . $verb . ' the document ' . '<strong>' . $handles[$document_phid]->renderLink() . '</strong>.');
     $view->setEpoch($data->getEpoch());
     $action = $data->getValue('action');
     switch ($action) {
         case PhrictionActionConstants::ACTION_CREATE:
             $full_size = true;
             break;
         default:
             $full_size = false;
             break;
     }
     if ($full_size) {
         if (!empty($objects[$author_phid])) {
             $image_phid = $objects[$author_phid]->getProfileImagePHID();
             $image_uri = PhabricatorFileURI::getViewURIForPHID($image_phid);
             $view->setImage($image_uri);
         }
         $content = phutil_escape_html($data->getValue('content'));
         $content = str_replace("\n", '<br />', $content);
         $view->appendChild($content);
     } else {
         $view->setOneLineStory(true);
     }
     return $view;
 }
 public function renderView()
 {
     $data = $this->getStoryData();
     $author_phid = $data->getAuthorPHID();
     $owner_phid = $data->getValue('ownerPHID');
     $task_phid = $data->getValue('taskPHID');
     $objects = $this->getObjects();
     $action = $data->getValue('action');
     $view = new PhabricatorFeedStoryView();
     $verb = ManiphestAction::getActionPastTenseVerb($action);
     $extra = null;
     switch ($action) {
         case ManiphestAction::ACTION_ASSIGN:
             if ($owner_phid) {
                 $extra = ' to ' . '<strong>' . $this->getHandle($owner_phid)->renderLink() . '</strong>';
             } else {
                 $verb = 'placed';
                 $extra = ' up for grabs';
             }
             break;
     }
     $title = '<strong>' . $this->getHandle($author_phid)->renderLink() . '</strong>' . " {$verb} task " . '<strong>' . $this->getHandle($task_phid)->renderLink() . '</strong>';
     $title .= $extra;
     $title .= '.';
     $view->setTitle($title);
     switch ($action) {
         case ManiphestAction::ACTION_CREATE:
             $full_size = true;
             break;
         default:
             $full_size = false;
             break;
     }
     $view->setEpoch($data->getEpoch());
     if ($full_size) {
         if (!empty($objects[$author_phid])) {
             $image_phid = $objects[$author_phid]->getProfileImagePHID();
             $image_uri = PhabricatorFileURI::getViewURIForPHID($image_phid);
             $view->setImage($image_uri);
         }
         $content = phutil_escape_html(phutil_utf8_shorten($data->getValue('description'), 128));
         $content = str_replace("\n", '<br />', $content);
         $view->appendChild($content);
     } else {
         $view->setOneLineStory(true);
     }
     return $view;
 }
 public function renderView()
 {
     $data = $this->getStoryData();
     $author_phid = $data->getAuthorPHID();
     $view = new PhabricatorFeedStoryView();
     $view->setTitle($this->linkTo($author_phid));
     $view->setEpoch($data->getEpoch());
     $view->setImage($this->getHandle($author_phid)->getImageURI());
     $content = $this->renderSummary($data->getValue('content'), $len = null);
     $view->appendChild($content);
     return $view;
 }
 public function renderView()
 {
     $data = $this->getStoryData();
     $author_phid = $data->getAuthorPHID();
     $owner_phid = $data->getValue('ownerPHID');
     $task_phid = $data->getValue('taskPHID');
     $action = $data->getValue('action');
     $view = new PhabricatorFeedStoryView();
     $verb = ManiphestAction::getActionPastTenseVerb($action);
     $extra = null;
     switch ($action) {
         case ManiphestAction::ACTION_ASSIGN:
             if ($owner_phid) {
                 $extra = ' to ' . $this->linkTo($owner_phid);
             } else {
                 $verb = 'placed';
                 $extra = ' up for grabs';
             }
             break;
     }
     $title = $this->linkTo($author_phid) . " {$verb} task " . $this->linkTo($task_phid);
     $title .= $extra;
     $title .= '.';
     $view->setTitle($title);
     switch ($action) {
         case ManiphestAction::ACTION_CREATE:
             $full_size = true;
             break;
         default:
             $full_size = false;
             break;
     }
     $view->setEpoch($data->getEpoch());
     if ($full_size) {
         $view->setImage($this->getHandle($author_phid)->getImageURI());
         $content = $this->renderSummary($data->getValue('description'));
         $view->appendChild($content);
     } else {
         $view->setOneLineStory(true);
     }
     return $view;
 }
 public function renderView()
 {
     $data = $this->getStoryData();
     $handles = $this->getHandles();
     $author_phid = $data->getAuthorPHID();
     $objects = $this->getObjects();
     $view = new PhabricatorFeedStoryView();
     $view->setTitle('<strong>' . $handles[$author_phid]->renderLink() . '</strong>');
     $view->setEpoch($data->getEpoch());
     if (!empty($objects[$author_phid])) {
         $image_phid = $objects[$author_phid]->getProfileImagePHID();
         $image_uri = PhabricatorFileURI::getViewURIForPHID($image_phid);
         $view->setImage($image_uri);
     }
     $content = phutil_escape_html($data->getValue('content'));
     $content = str_replace("\n", '<br />', $content);
     $view->appendChild($content);
     return $view;
 }
 public function renderView()
 {
     $data = $this->getStoryData();
     $author = null;
     if ($data->getValue('authorPHID')) {
         $author = $this->linkTo($data->getValue('authorPHID'));
     } else {
         $author = phutil_escape_html($data->getValue('authorName'));
     }
     $committer = null;
     if ($data->getValue('committerPHID')) {
         $committer = $this->linkTo($data->getValue('committerPHID'));
     } else {
         if ($data->getValue('committerName')) {
             $committer = phutil_escape_html($data->getValue('committerName'));
         }
     }
     $commit = $this->linkTo($data->getValue('commitPHID'));
     if (!$committer) {
         $committer = $author;
         $author = null;
     }
     if ($author) {
         $title = "{$committer} committed {$commit} (authored by {$author})";
     } else {
         $title = "{$committer} committed {$commit}";
     }
     $view = new PhabricatorFeedStoryView();
     $view->setTitle($title);
     $view->setEpoch($data->getEpoch());
     if ($data->getValue('authorPHID')) {
         $view->setImage($this->getHandle($data->getAuthorPHID())->getImageURI());
     }
     $content = $this->renderSummary($data->getValue('summary'));
     $view->appendChild($content);
     return $view;
 }