@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.

Add a list of all notifications

Summary: Add a "View All Notifications" link and page.

Test Plan: Viewed all notifications

Reviewers: jungejason, vrana

Reviewed By: jungejason

CC: aran

Maniphest Tasks: T974

Differential Revision: https://secure.phabricator.com/D2780

+81 -13
+3
src/__phutil_library_map__.php
··· 744 744 'PhabricatorNotificationBuilder' => 'applications/notification/builder/PhabricatorNotificationBuilder.php', 745 745 'PhabricatorNotificationController' => 'applications/notification/controller/PhabricatorNotificationController.php', 746 746 'PhabricatorNotificationIndividualController' => 'applications/notification/controller/PhabricatorNotificationIndividualController.php', 747 + 'PhabricatorNotificationListController' => 'applications/notification/controller/PhabricatorNotificationListController.php', 747 748 'PhabricatorNotificationPanelController' => 'applications/notification/controller/PhabricatorNotificationPanelController.php', 748 749 'PhabricatorNotificationQuery' => 'applications/notification/PhabricatorNotificationQuery.php', 749 750 'PhabricatorNotificationStatusController' => 'applications/notification/controller/PhabricatorNotificationStatusController.php', ··· 1715 1716 'PhabricatorMySQLFileStorageEngine' => 'PhabricatorFileStorageEngine', 1716 1717 'PhabricatorNotificationController' => 'PhabricatorController', 1717 1718 'PhabricatorNotificationIndividualController' => 'PhabricatorNotificationController', 1719 + 'PhabricatorNotificationListController' => 'PhabricatorNotificationController', 1718 1720 'PhabricatorNotificationPanelController' => 'PhabricatorNotificationController', 1721 + 'PhabricatorNotificationQuery' => 'PhabricatorOffsetPagedQuery', 1719 1722 'PhabricatorNotificationStatusController' => 'PhabricatorNotificationController', 1720 1723 'PhabricatorNotificationStoryView' => 'PhabricatorNotificationView', 1721 1724 'PhabricatorNotificationView' => 'AphrontView',
+1
src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
··· 427 427 ), 428 428 429 429 '/notification/' => array( 430 + '' => 'PhabricatorNotificationListController', 430 431 'panel/' => 'PhabricatorNotificationPanelController', 431 432 'individual/' => 'PhabricatorNotificationIndividualController', 432 433 'status/' => 'PhabricatorNotificationStatusController',
+4 -13
src/applications/notification/PhabricatorNotificationQuery.php
··· 16 16 * limitations under the License. 17 17 */ 18 18 19 - final class PhabricatorNotificationQuery { 19 + final class PhabricatorNotificationQuery extends PhabricatorOffsetPagedQuery { 20 20 21 - private $limit = 100; 22 21 private $userPHID; 23 - 24 - 25 - public function setLimit($limit) { 26 - $this->limit = $limit; 27 - return $this; 28 - } 29 22 30 23 public function setUserPHID($user_phid) { 31 24 $this->userPHID = $user_phid; 32 25 return $this; 33 26 } 34 27 35 - 36 28 public function execute() { 37 29 if (!$this->userPHID) { 38 30 throw new Exception("Call setUser() before executing the query"); 39 31 } 40 32 41 - //TODO throw an exception if no user 42 33 $story_table = new PhabricatorFeedStoryData(); 43 34 $notification_table = new PhabricatorFeedStoryNotification(); 44 35 ··· 49 40 "SELECT story.*, notif.hasViewed FROM %T notif 50 41 JOIN %T story ON notif.chronologicalKey = story.chronologicalKey 51 42 WHERE notif.userPHID = %s 52 - ORDER BY notif.chronologicalKey desc 53 - LIMIT %d", 43 + ORDER BY notif.chronologicalKey DESC 44 + %Q", 54 45 $notification_table->getTableName(), 55 46 $story_table->getTableName(), 56 47 $this->userPHID, 57 - $this->limit); 48 + $this->buildLimitClause($conn)); 58 49 59 50 $viewed_map = ipull($data, 'hasViewed', 'chronologicalKey'); 60 51 $data = $story_table->loadAllFromArray($data);
+56
src/applications/notification/controller/PhabricatorNotificationListController.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + final class PhabricatorNotificationListController 20 + extends PhabricatorNotificationController { 21 + 22 + public function processRequest() { 23 + $request = $this->getRequest(); 24 + $user = $request->getUser(); 25 + 26 + $pager = new AphrontPagerView(); 27 + $pager->setURI($request->getRequestURI(), 'offset'); 28 + $pager->setOffset($request->getInt('offset')); 29 + 30 + $query = new PhabricatorNotificationQuery(); 31 + $query->setUserPHID($user->getPHID()); 32 + $notifications = $query->executeWithPager($pager); 33 + 34 + if ($notifications) { 35 + $builder = new PhabricatorNotificationBuilder($notifications); 36 + $view = $builder->buildView(); 37 + } else { 38 + $view = 39 + '<div class="phabricator-notification no-notifications">'. 40 + 'You have no notifications.'. 41 + '</div>'; 42 + } 43 + 44 + $panel = new AphrontPanelView(); 45 + $panel->setHeader('Notifications'); 46 + $panel->appendChild($view); 47 + $panel->appendChild($pager); 48 + 49 + return $this->buildStandardPageResponse( 50 + $panel, 51 + array( 52 + 'title' => 'Notifications', 53 + )); 54 + } 55 + 56 + }
+10
src/applications/notification/controller/PhabricatorNotificationPanelController.php
··· 48 48 '</div>'; 49 49 } 50 50 51 + $content .= 52 + '<div class="phabricator-notification view-all-notifications">'. 53 + phutil_render_tag( 54 + 'a', 55 + array( 56 + 'href' => '/notification/', 57 + ), 58 + 'View All Notifications'). 59 + '</div>'; 60 + 51 61 $json = array( 52 62 'content' => $content, 53 63 'number' => $num_unconsumed,
+7
webroot/rsrc/css/application/base/standard-page-view.css
··· 310 310 .phabricator-notification-unread { 311 311 background: #aacfef; 312 312 } 313 + 314 + .view-all-notifications { 315 + text-align: center; 316 + font-weight: bold; 317 + background: #eeeeee; 318 + border-top: 1px solid #dddddd; 319 + }