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

Show notification text for non-reload notifications

Summary:
Show all notifications, but make the non-reload ones transient.

Depends on D2781, D2780

Test Plan: {F12986}

Reviewers: jungejason, vrana

Reviewed By: jungejason

CC: aran

Maniphest Tasks: T944

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

+96 -45
+27 -27
src/__celerity_resource_map__.php
··· 779 779 ), 780 780 'javelin-behavior-aphlict-listen' => 781 781 array( 782 - 'uri' => '/res/204f141a/rsrc/js/application/aphlict/behavior-aphlict-listen.js', 782 + 'uri' => '/res/da96a861/rsrc/js/application/aphlict/behavior-aphlict-listen.js', 783 783 'type' => 'js', 784 784 'requires' => 785 785 array( ··· 2314 2314 ), 2315 2315 'phabricator-standard-page-view' => 2316 2316 array( 2317 - 'uri' => '/res/4e1958d0/rsrc/css/application/base/standard-page-view.css', 2317 + 'uri' => '/res/b9c03b7b/rsrc/css/application/base/standard-page-view.css', 2318 2318 'type' => 'css', 2319 2319 'requires' => 2320 2320 array( ··· 2569 2569 ), array( 2570 2570 'packages' => 2571 2571 array( 2572 - '0ba8269e' => 2572 + 'e6c01476' => 2573 2573 array( 2574 2574 'name' => 'core.pkg.css', 2575 2575 'symbols' => ··· 2598 2598 21 => 'phabricator-flag-css', 2599 2599 22 => 'aphront-error-view-css', 2600 2600 ), 2601 - 'uri' => '/res/pkg/0ba8269e/core.pkg.css', 2601 + 'uri' => '/res/pkg/e6c01476/core.pkg.css', 2602 2602 'type' => 'css', 2603 2603 ), 2604 2604 '0c96375e' => ··· 2765 2765 'reverse' => 2766 2766 array( 2767 2767 'aphront-attached-file-view-css' => '7839ae2d', 2768 - 'aphront-crumbs-view-css' => '0ba8269e', 2769 - 'aphront-dialog-view-css' => '0ba8269e', 2770 - 'aphront-error-view-css' => '0ba8269e', 2771 - 'aphront-form-view-css' => '0ba8269e', 2768 + 'aphront-crumbs-view-css' => 'e6c01476', 2769 + 'aphront-dialog-view-css' => 'e6c01476', 2770 + 'aphront-error-view-css' => 'e6c01476', 2771 + 'aphront-form-view-css' => 'e6c01476', 2772 2772 'aphront-headsup-action-list-view-css' => '32f461a4', 2773 - 'aphront-headsup-view-css' => '0ba8269e', 2774 - 'aphront-list-filter-view-css' => '0ba8269e', 2775 - 'aphront-pager-view-css' => '0ba8269e', 2776 - 'aphront-panel-view-css' => '0ba8269e', 2777 - 'aphront-side-nav-view-css' => '0ba8269e', 2778 - 'aphront-table-view-css' => '0ba8269e', 2779 - 'aphront-tokenizer-control-css' => '0ba8269e', 2780 - 'aphront-tooltip-css' => '0ba8269e', 2781 - 'aphront-typeahead-control-css' => '0ba8269e', 2773 + 'aphront-headsup-view-css' => 'e6c01476', 2774 + 'aphront-list-filter-view-css' => 'e6c01476', 2775 + 'aphront-pager-view-css' => 'e6c01476', 2776 + 'aphront-panel-view-css' => 'e6c01476', 2777 + 'aphront-side-nav-view-css' => 'e6c01476', 2778 + 'aphront-table-view-css' => 'e6c01476', 2779 + 'aphront-tokenizer-control-css' => 'e6c01476', 2780 + 'aphront-tooltip-css' => 'e6c01476', 2781 + 'aphront-typeahead-control-css' => 'e6c01476', 2782 2782 'differential-changeset-view-css' => '32f461a4', 2783 2783 'differential-core-view-css' => '32f461a4', 2784 2784 'differential-inline-comment-editor' => '1662d764', ··· 2844 2844 'javelin-workflow' => '0c96375e', 2845 2845 'maniphest-task-summary-css' => '7839ae2d', 2846 2846 'maniphest-transaction-detail-css' => '7839ae2d', 2847 - 'phabricator-app-buttons-css' => '0ba8269e', 2847 + 'phabricator-app-buttons-css' => 'e6c01476', 2848 2848 'phabricator-content-source-view-css' => '32f461a4', 2849 - 'phabricator-core-buttons-css' => '0ba8269e', 2850 - 'phabricator-core-css' => '0ba8269e', 2851 - 'phabricator-directory-css' => '0ba8269e', 2849 + 'phabricator-core-buttons-css' => 'e6c01476', 2850 + 'phabricator-core-css' => 'e6c01476', 2851 + 'phabricator-directory-css' => 'e6c01476', 2852 2852 'phabricator-drag-and-drop-file-upload' => '1662d764', 2853 2853 'phabricator-dropdown-menu' => '0c96375e', 2854 - 'phabricator-flag-css' => '0ba8269e', 2855 - 'phabricator-jump-nav' => '0ba8269e', 2854 + 'phabricator-flag-css' => 'e6c01476', 2855 + 'phabricator-jump-nav' => 'e6c01476', 2856 2856 'phabricator-keyboard-shortcut' => '0c96375e', 2857 2857 'phabricator-keyboard-shortcut-manager' => '0c96375e', 2858 2858 'phabricator-menu-item' => '0c96375e', ··· 2860 2860 'phabricator-paste-file-upload' => '0c96375e', 2861 2861 'phabricator-prefab' => '0c96375e', 2862 2862 'phabricator-project-tag-css' => '7839ae2d', 2863 - 'phabricator-remarkup-css' => '0ba8269e', 2863 + 'phabricator-remarkup-css' => 'e6c01476', 2864 2864 'phabricator-shaped-request' => '1662d764', 2865 - 'phabricator-standard-page-view' => '0ba8269e', 2865 + 'phabricator-standard-page-view' => 'e6c01476', 2866 2866 'phabricator-tooltip' => '0c96375e', 2867 - 'phabricator-transaction-view-css' => '0ba8269e', 2868 - 'syntax-highlighting-css' => '0ba8269e', 2867 + 'phabricator-transaction-view-css' => 'e6c01476', 2868 + 'syntax-highlighting-css' => 'e6c01476', 2869 2869 ), 2870 2870 ));
+10
src/applications/feed/story/PhabricatorFeedStory.php
··· 22 22 private $hasViewed; 23 23 private $handles; 24 24 private $framed; 25 + private $primaryObjectPHID; 26 + 27 + public function setPrimaryObjectPHID($primary_object_phid) { 28 + $this->primaryObjectPHID = $primary_object_phid; 29 + return $this; 30 + } 31 + 32 + public function getPrimaryObjectPHID() { 33 + return $this->primaryObjectPHID; 34 + } 25 35 26 36 final public function __construct(PhabricatorFeedStoryData $data) { 27 37 $this->data = $data;
+33 -3
src/applications/notification/PhabricatorNotificationQuery.php
··· 19 19 final class PhabricatorNotificationQuery extends PhabricatorOffsetPagedQuery { 20 20 21 21 private $userPHID; 22 + private $keys; 22 23 23 24 public function setUserPHID($user_phid) { 24 25 $this->userPHID = $user_phid; 26 + return $this; 27 + } 28 + 29 + public function withKeys(array $keys) { 30 + $this->keys = $keys; 25 31 return $this; 26 32 } 27 33 ··· 37 43 38 44 $data = queryfx_all( 39 45 $conn, 40 - "SELECT story.*, notif.hasViewed FROM %T notif 46 + "SELECT story.*, notif.primaryObjectPHID, notif.hasViewed FROM %T notif 41 47 JOIN %T story ON notif.chronologicalKey = story.chronologicalKey 42 - WHERE notif.userPHID = %s 48 + %Q 43 49 ORDER BY notif.chronologicalKey DESC 44 50 %Q", 45 51 $notification_table->getTableName(), 46 52 $story_table->getTableName(), 47 - $this->userPHID, 53 + $this->buildWhereClause($conn), 48 54 $this->buildLimitClause($conn)); 49 55 50 56 $viewed_map = ipull($data, 'hasViewed', 'chronologicalKey'); 57 + $primary_map = ipull($data, 'primaryObjectPHID', 'chronologicalKey'); 58 + 51 59 $data = $story_table->loadAllFromArray($data); 52 60 53 61 $stories = array(); ··· 64 72 } 65 73 $story = newv($class, array($story_data)); 66 74 $story->setHasViewed($viewed_map[$story->getChronologicalKey()]); 75 + $story->setPrimaryObjectPHID($primary_map[$story->getChronologicalKey()]); 67 76 $stories[] = $story; 68 77 } 69 78 70 79 return $stories; 71 80 } 81 + 82 + private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 83 + $where = array(); 84 + 85 + if ($this->userPHID) { 86 + $where[] = qsprintf( 87 + $conn_r, 88 + 'notif.userPHID = %s', 89 + $this->userPHID); 90 + } 91 + 92 + if ($this->keys) { 93 + $where[] = qsprintf( 94 + $conn_r, 95 + 'notif.chronologicalKey IN (%Ls)', 96 + $this->keys); 97 + } 98 + 99 + return $this->formatWhereClause($where); 100 + } 101 + 72 102 }
+19 -13
src/applications/notification/controller/PhabricatorNotificationIndividualController.php
··· 23 23 $request = $this->getRequest(); 24 24 $user = $request->getUser(); 25 25 26 - $chron_key = $request->getStr('key'); 27 - $story = id(new PhabricatorFeedStoryNotification()) 28 - ->loadOneWhere('userPHID = %s AND chronologicalKey = %s', 29 - $user->getPHID(), 30 - $chron_key); 26 + $stories = id(new PhabricatorNotificationQuery()) 27 + ->setUserPHID($user->getPHID()) 28 + ->withKeys(array($request->getStr('key'))) 29 + ->execute(); 31 30 32 - if ($story == null) { 33 - $json = array( "pertinent" => false ); 34 - } else { 35 - $json = array( 36 - "pertinent" => true, 37 - "primaryObjectPHID" => $story->getPrimaryObjectPHID(), 38 - ); 31 + if (!$stories) { 32 + return id(new AphrontAjaxResponse())->setContent( 33 + array( 34 + 'pertinent' => false, 35 + )); 39 36 } 40 37 41 - return id(new AphrontAjaxResponse())->setContent($json); 38 + $builder = new PhabricatorNotificationBuilder($stories); 39 + $content = $builder->buildView()->render(); 40 + 41 + $response = array( 42 + 'pertinent' => true, 43 + 'primaryObjectPHID' => head($stories)->getPrimaryObjectPHID(), 44 + 'content' => $content, 45 + ); 46 + 47 + return id(new AphrontAjaxResponse())->setContent($response); 42 48 } 43 49 }
+1 -1
webroot/rsrc/css/application/base/standard-page-view.css
··· 307 307 color: #999999; 308 308 } 309 309 310 - .phabricator-notification-unread { 310 + #phabricator-notification-dropdown .phabricator-notification-unread { 311 311 background: #aacfef; 312 312 } 313 313
+6 -1
webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js
··· 45 45 46 46 JX.Stratcom.invoke('notification-panel-update', null, {}); 47 47 48 + // Show the notification itself. 49 + new JX.Notification() 50 + .setContent(JX.$H(response.content)) 51 + .show(); 52 + 53 + 48 54 // If the notification affected an object on this page, show a 49 55 // permanent reload notification if we aren't already. 50 - 51 56 if ((response.primaryObjectPHID in config.pageObjects) && 52 57 !showing_reload) { 53 58 var reload = new JX.Notification()