diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index c448c56a27..8c0af087d0 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -86,7 +86,9 @@ final class DiffusionCommitController extends DiffusionController { $commit_data, $parent_query->loadParents()); $property_list = id(new PhabricatorPropertyListView()) - ->setHasKeyboardShortcuts(true); + ->setHasKeyboardShortcuts(true) + ->setUser($user) + ->setObject($commit); foreach ($commit_properties as $key => $value) { $property_list->addProperty($key, $value); } @@ -98,6 +100,7 @@ final class DiffusionCommitController extends DiffusionController { $message = $engine->markupText($message); + $property_list->invokeWillRenderEvent(); $property_list->addTextContent( phutil_tag( 'div', @@ -105,7 +108,6 @@ final class DiffusionCommitController extends DiffusionController { 'class' => 'diffusion-commit-message phabricator-remarkup', ), $message)); - $content[] = $top_anchor; $content[] = $headsup_view; $content[] = $headsup_actions; diff --git a/src/applications/paste/controller/PhabricatorPasteViewController.php b/src/applications/paste/controller/PhabricatorPasteViewController.php index 85db9938df..f0e4c3f59c 100644 --- a/src/applications/paste/controller/PhabricatorPasteViewController.php +++ b/src/applications/paste/controller/PhabricatorPasteViewController.php @@ -120,7 +120,9 @@ final class PhabricatorPasteViewController extends PhabricatorPasteController { array $child_phids) { $user = $this->getRequest()->getUser(); - $properties = new PhabricatorPropertyListView(); + $properties = id(new PhabricatorPropertyListView()) + ->setUser($user) + ->setObject($paste); $properties->addProperty( pht('Author'), diff --git a/src/applications/paste/storage/PhabricatorPaste.php b/src/applications/paste/storage/PhabricatorPaste.php index ba87def552..dc1d697e08 100644 --- a/src/applications/paste/storage/PhabricatorPaste.php +++ b/src/applications/paste/storage/PhabricatorPaste.php @@ -1,7 +1,7 @@ getAuthorPHID(), + ); + } + } diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php index e39176955a..1240351f11 100644 --- a/src/applications/phame/controller/post/PhamePostViewController.php +++ b/src/applications/phame/controller/post/PhamePostViewController.php @@ -162,7 +162,9 @@ final class PhamePostViewController extends PhameController { PhamePost $post, PhabricatorUser $user) { - $properties = new PhabricatorPropertyListView(); + $properties = id(new PhabricatorPropertyListView()) + ->setUser($user) + ->setObject($post); $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( $user, @@ -193,6 +195,8 @@ final class PhamePostViewController extends PhameController { ->addObject($post, PhamePost::MARKUP_FIELD_BODY) ->process(); + $properties->invokeWillRenderEvent(); + $properties->addTextContent( phutil_tag( 'div', diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php index 62414a60ec..3809679c94 100644 --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -4,7 +4,10 @@ * @group phame */ final class PhamePost extends PhameDAO - implements PhabricatorPolicyInterface, PhabricatorMarkupInterface { + implements + PhabricatorPolicyInterface, + PhabricatorMarkupInterface, + PhabricatorTokenReceiverInterface { const MARKUP_FIELD_BODY = 'markup:body'; const MARKUP_FIELD_SUMMARY = 'markup:summary'; @@ -182,4 +185,12 @@ final class PhamePost extends PhameDAO return (bool)$this->getPHID(); } +/* -( PhabricatorTokenReceiverInterface )---------------------------------- */ + + public function getUsersToNotifyOfTokenGiven() { + return array( + $this->getBloggerPHID(), + ); + } + } diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index 3cb431dbee..58e1252dab 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -31,8 +31,8 @@ final class PhrictionDocumentController $version_note = null; $core_content = ''; - $byline = ''; $move_notice = ''; + $properties = null; if (!$document) { @@ -48,22 +48,17 @@ final class PhrictionDocumentController } $create_uri = '/phriction/edit/?slug='.$slug; - $no_content_head = pht('No content here!'); - $no_content_body = pht( - 'No document found at %s. You can '. - 'create a new document here.', - phutil_tag('tt', array(), $slug), - $create_uri); + $notice = new AphrontErrorView(); + $notice->setSeverity(AphrontErrorView::SEVERITY_NODATA); + $notice->setTitle(pht('No content here!')); + $notice->appendChild( + pht( + 'No document found at %s. You can '. + 'create a new document here.', + phutil_tag('tt', array(), $slug), + $create_uri)); + $core_content = $notice; - $no_content_text = hsprintf( - '%s
%s', - $no_content_head, - $no_content_body); - - $page_content = phutil_tag( - 'div', - array('class' => 'phriction-content'), - $no_content_text); $page_title = pht('Page Not Found'); } else { $version = $request->getInt('v'); @@ -90,75 +85,10 @@ final class PhrictionDocumentController } $page_title = $content->getTitle(); - $project_phid = null; - if (PhrictionDocument::isProjectSlug($slug)) { - $project = id(new PhabricatorProject())->loadOneWhere( - 'phrictionSlug = %s', - PhrictionDocument::getProjectSlugIdentifier($slug)); - if ($project) { - $project_phid = $project->getPHID(); - } - } - $subscribers = PhabricatorSubscribersQuery::loadSubscribersForPHID( $document->getPHID()); - - $phids = array_filter( - array( - $content->getAuthorPHID(), - $project_phid, - )); - - if ($subscribers) { - $phids = array_merge($phids, $subscribers); - } - - $handles = $this->loadViewerHandles($phids); - - $age = time() - $content->getDateCreated(); - $age = floor($age / (60 * 60 * 24)); - - if ($age < 1) { - $when = pht('today'); - } else if ($age == 1) { - $when = pht('yesterday'); - } else { - $when = pht("%d days ago", $age); - } - - - $project_info = null; - if ($project_phid) { - $project_info = hsprintf( - '
%s', - pht('This document is about the project %s.', - $handles[$project_phid]->renderLink())); - } - - $subscriber_view = null; - if ($subscribers) { - $subcriber_list = array(); - foreach ($subscribers as $subscriber) { - $subcriber_list[] = $handles[$subscriber]; - } - - $subcriber_list = phutil_implode_html(', ', - mpull($subcriber_list, 'renderLink')); - - $subscriber_view = array( - hsprintf('
Subscribers: '), - $subcriber_list, - ); - } - - $byline = hsprintf( - '
%s%s%s
', - pht('Last updated %s by %s.', - $when, - $handles[$content->getAuthorPHID()]->renderLink()), - $project_info, - $subscriber_view); - + $properties = $this + ->buildPropertyListView($document, $content, $slug, $subscribers); $doc_status = $document->getStatus(); $current_status = $content->getChangeType(); @@ -213,7 +143,6 @@ final class PhrictionDocumentController phutil_tag('a', array('href' => $slug_uri), $slug_uri))) ->render(); } - } if ($version_note) { @@ -234,18 +163,18 @@ final class PhrictionDocumentController $header = id(new PhabricatorHeaderView()) ->setHeader($page_title); - $page_content = hsprintf( - '
-
- %s%s%s%s%s -
-
-
', - $header, - $actions, - $byline, - $move_notice, - $core_content); + $page_content = hsprintf( + '
+
+ %s%s%s%s%s +
+
+
', + $header, + $actions, + $properties, + $move_notice, + $core_content); $core_page = phutil_tag( 'div', @@ -270,6 +199,69 @@ final class PhrictionDocumentController } + private function buildPropertyListView( + PhrictionDocument $document, + PhrictionContent $content, + $slug, + array $subscribers) { + + $viewer = $this->getRequest()->getUser(); + $view = id(new PhabricatorPropertyListView()) + ->setUser($viewer) + ->setObject($document); + + $project_phid = null; + if (PhrictionDocument::isProjectSlug($slug)) { + $project = id(new PhabricatorProject())->loadOneWhere( + 'phrictionSlug = %s', + PhrictionDocument::getProjectSlugIdentifier($slug)); + if ($project) { + $project_phid = $project->getPHID(); + } + } + + $phids = array_filter( + array( + $content->getAuthorPHID(), + $project_phid, + )); + + if ($subscribers) { + $phids = array_merge($phids, $subscribers); + } + + $this->loadHandles($phids); + + $project_info = null; + if ($project_phid) { + $view->addProperty( + pht('Project Info'), + $this->getHandle($project_phid)->renderLink()); + } + + $view->addProperty( + pht('Last Author'), + $this->getHandle($content->getAuthorPHID())->renderLink()); + + $age = time() - $content->getDateCreated(); + $age = floor($age / (60 * 60 * 24)); + if ($age < 1) { + $when = pht('Today'); + } else if ($age == 1) { + $when = pht('Yesterday'); + } else { + $when = pht("%d Days Ago", $age); + } + $view->addProperty(pht('Last Updated'), $when); + + if ($subscribers) { + $subscribers = $this->renderHandlesForPHIDs($subscribers); + $view->addProperty(pht('Subscribers'), $subscribers); + } + + return $view; + } + private function buildActionView( PhabricatorUser $user, PhrictionDocument $document) { diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php index f3bc38a705..af74769f29 100644 --- a/src/applications/phriction/storage/PhrictionDocument.php +++ b/src/applications/phriction/storage/PhrictionDocument.php @@ -4,7 +4,10 @@ * @group phriction */ final class PhrictionDocument extends PhrictionDAO - implements PhabricatorPolicyInterface, PhabricatorSubscribableInterface { + implements + PhabricatorPolicyInterface, + PhabricatorSubscribableInterface, + PhabricatorTokenReceiverInterface { protected $id; protected $phid; @@ -129,4 +132,10 @@ final class PhrictionDocument extends PhrictionDAO public function isAutomaticallySubscribed($phid) { return false; } + +/* -( PhabricatorTokenReceiverInterface )---------------------------------- */ + + public function getUsersToNotifyOfTokenGiven() { + return PhabricatorSubscribersQuery::loadSubscribersForPHID($this->phid); + } } diff --git a/src/applications/ponder/controller/PonderQuestionViewController.php b/src/applications/ponder/controller/PonderQuestionViewController.php index 758a0a6673..29ad9532c1 100644 --- a/src/applications/ponder/controller/PonderQuestionViewController.php +++ b/src/applications/ponder/controller/PonderQuestionViewController.php @@ -113,8 +113,9 @@ final class PonderQuestionViewController extends PonderController { array $subscribers) { $viewer = $this->getRequest()->getUser(); - $view = new PhabricatorPropertyListView(); - + $view = id(new PhabricatorPropertyListView()) + ->setUser($viewer) + ->setObject($question); $view->addProperty( pht('Author'), $this->getHandle($question->getAuthorPHID())->renderLink()); diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php index 9028681059..88160a35a1 100644 --- a/src/applications/ponder/storage/PonderQuestion.php +++ b/src/applications/ponder/storage/PonderQuestion.php @@ -5,7 +5,8 @@ final class PonderQuestion extends PonderDAO PhabricatorMarkupInterface, PonderVotableInterface, PhabricatorSubscribableInterface, - PhabricatorPolicyInterface { + PhabricatorPolicyInterface, + PhabricatorTokenReceiverInterface { const MARKUP_FIELD_CONTENT = 'markup:content'; @@ -190,4 +191,12 @@ final class PonderQuestion extends PonderDAO return false; } +/* -( PhabricatorTokenReceiverInterface )---------------------------------- */ + + public function getUsersToNotifyOfTokenGiven() { + return array( + $this->getAuthorPHID(), + ); + } + } diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php index b35df5596f..ff9d2367ea 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php +++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php @@ -2,7 +2,8 @@ final class PhabricatorRepositoryCommit extends PhabricatorRepositoryDAO - implements PhabricatorPolicyInterface { + implements PhabricatorPolicyInterface, + PhabricatorTokenReceiverInterface { protected $repositoryID; protected $phid; @@ -171,4 +172,12 @@ final class PhabricatorRepositoryCommit return $this->getRepository()->hasAutomaticCapability($capability, $viewer); } +/* -( PhabricatorTokenReceiverInterface )---------------------------------- */ + + public function getUsersToNotifyOfTokenGiven() { + return array( + $this->getAuthorPHID(), + ); + } + } diff --git a/src/applications/subscriptions/query/PhabricatorSubscribersQuery.php b/src/applications/subscriptions/query/PhabricatorSubscribersQuery.php index 0870fe27ee..73a5bf5a4b 100644 --- a/src/applications/subscriptions/query/PhabricatorSubscribersQuery.php +++ b/src/applications/subscriptions/query/PhabricatorSubscribersQuery.php @@ -49,6 +49,4 @@ final class PhabricatorSubscribersQuery extends PhabricatorQuery { return $results; } - - } diff --git a/webroot/rsrc/css/application/phriction/phriction-document-css.css b/webroot/rsrc/css/application/phriction/phriction-document-css.css index f2ea174839..899ae2b476 100644 --- a/webroot/rsrc/css/application/phriction/phriction-document-css.css +++ b/webroot/rsrc/css/application/phriction/phriction-document-css.css @@ -62,17 +62,6 @@ padding: 20px; } -.phriction-byline { - padding: 10px 20px; - color: #777; - font-size: 11px; - background: #f7f7f7; -} - -.device-phone .phriction-byline { - padding: 10px; -} - .device-phone .phriction-content .phabricator-remarkup { padding: 10px; }