@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Keebuhm Park and committed by
epriestley
c67f4573 eb9ecab1

+52 -12
+4
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 363 363 if ($comment_form) { 364 364 $page_pane->appendChild($comment_form->render()); 365 365 } 366 + 367 + PhabricatorFeedStoryNotification::updateObjectNotificationViews( 368 + $user, $revision->getPHID()); 369 + 366 370 return $this->buildStandardPageResponse( 367 371 array( 368 372 $reviewer_warning,
+6
src/applications/differential/editor/DifferentialCommentEditor.php
··· 575 575 $this->actorPHID, 576 576 $revision->getAuthorPHID(), 577 577 )) 578 + ->setPrimaryObjectPHID($revision->getPHID()) 579 + ->setSubscribedPHIDs( 580 + array_merge( 581 + array($revision->getAuthorPHID()), 582 + $revision->getReviewers(), 583 + $revision->getCCPHIDs())) 578 584 ->publish(); 579 585 580 586 // TODO: Move to a daemon?
+6
src/applications/differential/editor/DifferentialRevisionEditor.php
··· 437 437 $revision->getPHID(), 438 438 $revision->getAuthorPHID(), 439 439 )) 440 + ->setPrimaryObjectPHID($revision->getPHID()) 441 + ->setSubscribedPHIDs( 442 + array_merge( 443 + array($revision->getAuthorPHID()), 444 + $revision->getReviewers(), 445 + $revision->getCCPHIDs())) 440 446 ->publish(); 441 447 442 448 // TODO: Move this into a worker task thing.
+36 -12
src/applications/feed/story/PhabricatorFeedStoryDifferential.php
··· 36 36 public function renderView() { 37 37 $data = $this->getStoryData(); 38 38 39 - $author_phid = $data->getAuthorPHID(); 40 - 41 39 $view = new PhabricatorFeedStoryView(); 42 40 43 - $revision_phid = $data->getValue('revision_phid'); 44 - 45 - $action = $data->getValue('action'); 46 - $verb = DifferentialAction::getActionPastTenseVerb($action); 47 - 48 - $view->setTitle( 49 - $this->linkTo($author_phid). 50 - " {$verb} revision ". 51 - $this->linkTo($revision_phid).'.'); 41 + $line = $this->getLineForData($data); 42 + $view->setTitle($line); 52 43 $view->setEpoch($data->getEpoch()); 53 44 54 45 $action = $data->getValue('action'); ··· 63 54 } 64 55 65 56 if ($full_size) { 66 - $view->setImage($this->getHandle($author_phid)->getImageURI()); 57 + $view->setImage($this->getHandle($data->getAuthorPHID())->getImageURI()); 67 58 $content = $this->renderSummary($data->getValue('feedback_content')); 68 59 $view->appendChild($content); 69 60 } else { ··· 73 64 return $view; 74 65 } 75 66 67 + public function renderNotificationView() { 68 + $data = $this->getStoryData(); 69 + 70 + $view = new PhabricatorNotificationStoryView(); 71 + 72 + $view->setTitle($this->getLineForData($data)); 73 + $view->setEpoch($data->getEpoch()); 74 + $view->setViewed($this->getHasViewed()); 75 + 76 + return $view; 77 + } 78 + 79 + private function getLineForData($data) { 80 + $actor_phid = $data->getAuthorPHID(); 81 + $owner_phid = $data->getValue('revision_author_phid'); 82 + $revision_phid = $data->getValue('revision_phid'); 83 + $action = $data->getValue('action'); 84 + $comments = $data->getValue('feedback_content'); 85 + 86 + $actor_link = $this->linkTo($actor_phid); 87 + $revision_link = $this->linkTo($revision_phid); 88 + $owner_link = $this->linkTo($owner_phid); 89 + 90 + $verb = DifferentialAction::getActionPastTenseVerb($action); 91 + 92 + $one_line = "{$actor_link} {$verb} revision {$revision_link}"; 93 + 94 + if ($comments) { 95 + $one_line .= " \"{$comments}\""; 96 + } 97 + 98 + return $one_line; 99 + } 76 100 }