diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 7cd27056c5..4bd0cb5655 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -363,6 +363,10 @@ final class DifferentialRevisionViewController extends DifferentialController { if ($comment_form) { $page_pane->appendChild($comment_form->render()); } + + PhabricatorFeedStoryNotification::updateObjectNotificationViews( + $user, $revision->getPHID()); + return $this->buildStandardPageResponse( array( $reviewer_warning, diff --git a/src/applications/differential/editor/DifferentialCommentEditor.php b/src/applications/differential/editor/DifferentialCommentEditor.php index b1f21c1262..44d078a93a 100644 --- a/src/applications/differential/editor/DifferentialCommentEditor.php +++ b/src/applications/differential/editor/DifferentialCommentEditor.php @@ -575,6 +575,12 @@ final class DifferentialCommentEditor { $this->actorPHID, $revision->getAuthorPHID(), )) + ->setPrimaryObjectPHID($revision->getPHID()) + ->setSubscribedPHIDs( + array_merge( + array($revision->getAuthorPHID()), + $revision->getReviewers(), + $revision->getCCPHIDs())) ->publish(); // TODO: Move to a daemon? diff --git a/src/applications/differential/editor/DifferentialRevisionEditor.php b/src/applications/differential/editor/DifferentialRevisionEditor.php index 491854d850..eab033a6c4 100644 --- a/src/applications/differential/editor/DifferentialRevisionEditor.php +++ b/src/applications/differential/editor/DifferentialRevisionEditor.php @@ -437,6 +437,12 @@ final class DifferentialRevisionEditor { $revision->getPHID(), $revision->getAuthorPHID(), )) + ->setPrimaryObjectPHID($revision->getPHID()) + ->setSubscribedPHIDs( + array_merge( + array($revision->getAuthorPHID()), + $revision->getReviewers(), + $revision->getCCPHIDs())) ->publish(); // TODO: Move this into a worker task thing. diff --git a/src/applications/feed/story/PhabricatorFeedStoryDifferential.php b/src/applications/feed/story/PhabricatorFeedStoryDifferential.php index efa55e6766..ae1dc242f5 100644 --- a/src/applications/feed/story/PhabricatorFeedStoryDifferential.php +++ b/src/applications/feed/story/PhabricatorFeedStoryDifferential.php @@ -36,19 +36,10 @@ final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory { 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).'.'); + $line = $this->getLineForData($data); + $view->setTitle($line); $view->setEpoch($data->getEpoch()); $action = $data->getValue('action'); @@ -63,7 +54,7 @@ final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory { } if ($full_size) { - $view->setImage($this->getHandle($author_phid)->getImageURI()); + $view->setImage($this->getHandle($data->getAuthorPHID())->getImageURI()); $content = $this->renderSummary($data->getValue('feedback_content')); $view->appendChild($content); } else { @@ -73,4 +64,37 @@ final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory { return $view; } + public function renderNotificationView() { + $data = $this->getStoryData(); + + $view = new PhabricatorNotificationStoryView(); + + $view->setTitle($this->getLineForData($data)); + $view->setEpoch($data->getEpoch()); + $view->setViewed($this->getHasViewed()); + + return $view; + } + + private function getLineForData($data) { + $actor_phid = $data->getAuthorPHID(); + $owner_phid = $data->getValue('revision_author_phid'); + $revision_phid = $data->getValue('revision_phid'); + $action = $data->getValue('action'); + $comments = $data->getValue('feedback_content'); + + $actor_link = $this->linkTo($actor_phid); + $revision_link = $this->linkTo($revision_phid); + $owner_link = $this->linkTo($owner_phid); + + $verb = DifferentialAction::getActionPastTenseVerb($action); + + $one_line = "{$actor_link} {$verb} revision {$revision_link}"; + + if ($comments) { + $one_line .= " \"{$comments}\""; + } + + return $one_line; + } }