1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Notification implementation for Differential

Summary: The notification implementation has been extended to Differential. Appropriate changes have been made to the Differential editors and Differential feed story.

Test Plan: Tested out various actions available for Differential and confirmed that the notifications get delivered correctly and feed is generated.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: allenjohnashton, ddfisher, aran, Korvin

Differential Revision: https://secure.phabricator.com/D2696
This commit is contained in:
Keebuhm Park 2012-06-08 18:45:26 -07:00 committed by epriestley
parent eb9ecab163
commit c67f45734d
4 changed files with 52 additions and 12 deletions

View file

@ -363,6 +363,10 @@ final class DifferentialRevisionViewController extends DifferentialController {
if ($comment_form) { if ($comment_form) {
$page_pane->appendChild($comment_form->render()); $page_pane->appendChild($comment_form->render());
} }
PhabricatorFeedStoryNotification::updateObjectNotificationViews(
$user, $revision->getPHID());
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
array( array(
$reviewer_warning, $reviewer_warning,

View file

@ -575,6 +575,12 @@ final class DifferentialCommentEditor {
$this->actorPHID, $this->actorPHID,
$revision->getAuthorPHID(), $revision->getAuthorPHID(),
)) ))
->setPrimaryObjectPHID($revision->getPHID())
->setSubscribedPHIDs(
array_merge(
array($revision->getAuthorPHID()),
$revision->getReviewers(),
$revision->getCCPHIDs()))
->publish(); ->publish();
// TODO: Move to a daemon? // TODO: Move to a daemon?

View file

@ -437,6 +437,12 @@ final class DifferentialRevisionEditor {
$revision->getPHID(), $revision->getPHID(),
$revision->getAuthorPHID(), $revision->getAuthorPHID(),
)) ))
->setPrimaryObjectPHID($revision->getPHID())
->setSubscribedPHIDs(
array_merge(
array($revision->getAuthorPHID()),
$revision->getReviewers(),
$revision->getCCPHIDs()))
->publish(); ->publish();
// TODO: Move this into a worker task thing. // TODO: Move this into a worker task thing.

View file

@ -36,19 +36,10 @@ final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory {
public function renderView() { public function renderView() {
$data = $this->getStoryData(); $data = $this->getStoryData();
$author_phid = $data->getAuthorPHID();
$view = new PhabricatorFeedStoryView(); $view = new PhabricatorFeedStoryView();
$revision_phid = $data->getValue('revision_phid'); $line = $this->getLineForData($data);
$view->setTitle($line);
$action = $data->getValue('action');
$verb = DifferentialAction::getActionPastTenseVerb($action);
$view->setTitle(
$this->linkTo($author_phid).
" {$verb} revision ".
$this->linkTo($revision_phid).'.');
$view->setEpoch($data->getEpoch()); $view->setEpoch($data->getEpoch());
$action = $data->getValue('action'); $action = $data->getValue('action');
@ -63,7 +54,7 @@ final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory {
} }
if ($full_size) { if ($full_size) {
$view->setImage($this->getHandle($author_phid)->getImageURI()); $view->setImage($this->getHandle($data->getAuthorPHID())->getImageURI());
$content = $this->renderSummary($data->getValue('feedback_content')); $content = $this->renderSummary($data->getValue('feedback_content'));
$view->appendChild($content); $view->appendChild($content);
} else { } else {
@ -73,4 +64,37 @@ final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory {
return $view; 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;
}
} }