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

Make "No Notifications" setting less broad, and fix a bug with default display behavior

Summary:
Fixes T12979. In D18457, we added a "No Notifications" setting to let users disable the blue and yellow pop-up notifications that alert you when an object has been updated, since some users found them distracting.

However, the change made "do nothing" the default, so all other `JX.Notification` callsites -- which never pass a preference -- were effectively turned off no matter what your setting was set to. This includes the "Read-Only" mode warning (grey), the "High Security" mode warning (purple), the "timezone" warning, and a few others.

Tweak things a little bit so the setting applies to ONLY blue and yellow ("object you're following was updated" / "this object was updated") notifications, not other types of popup notifications.

Test Plan:
- With notifications on in settings, got blue notifications and "Read-only".
- With notifications off in settings, got "Read-only" but no blue notifications.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T12979

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

+42 -56
+26 -26
resources/celerity/map.php
··· 10 10 'conpherence.pkg.css' => 'e68cf1fa', 11 11 'conpherence.pkg.js' => 'b5b51108', 12 12 'core.pkg.css' => 'e9473020', 13 - 'core.pkg.js' => '6c085267', 13 + 'core.pkg.js' => '28552e58', 14 14 'darkconsole.pkg.js' => '1f9a31bc', 15 15 'differential.pkg.css' => '45951e9e', 16 16 'differential.pkg.js' => 'b71b8c5d', ··· 374 374 'rsrc/image/texture/table_header_tall.png' => 'd56b434f', 375 375 'rsrc/js/application/aphlict/Aphlict.js' => 'e1d4b11a', 376 376 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'caade6f2', 377 - 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'a14cbdfc', 377 + 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '4cc4f460', 378 378 'rsrc/js/application/aphlict/behavior-aphlict-status.js' => '5e2634b9', 379 379 'rsrc/js/application/aphlict/behavior-desktop-notifications-control.js' => '27ca6289', 380 380 'rsrc/js/application/calendar/behavior-day-view.js' => '4b3c4443', ··· 467 467 'rsrc/js/core/KeyboardShortcut.js' => '1ae869f2', 468 468 'rsrc/js/core/KeyboardShortcutManager.js' => 'c19dd9b9', 469 469 'rsrc/js/core/MultirowRowManager.js' => 'b5d57730', 470 - 'rsrc/js/core/Notification.js' => '5c3349b2', 470 + 'rsrc/js/core/Notification.js' => '008faf9c', 471 471 'rsrc/js/core/Prefab.js' => 'c5af80a2', 472 472 'rsrc/js/core/ShapedRequest.js' => '7cbe244b', 473 473 'rsrc/js/core/TextAreaUtils.js' => '320810c8', ··· 585 585 'javelin-aphlict' => 'e1d4b11a', 586 586 'javelin-behavior' => '61cbc29a', 587 587 'javelin-behavior-aphlict-dropdown' => 'caade6f2', 588 - 'javelin-behavior-aphlict-listen' => 'a14cbdfc', 588 + 'javelin-behavior-aphlict-listen' => '4cc4f460', 589 589 'javelin-behavior-aphlict-status' => '5e2634b9', 590 590 'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884', 591 591 'javelin-behavior-aphront-drag-and-drop-textarea' => '484a6e22', ··· 789 789 'phabricator-keyboard-shortcut-manager' => 'c19dd9b9', 790 790 'phabricator-main-menu-view' => '1802a242', 791 791 'phabricator-nav-view-css' => 'faf6a6fc', 792 - 'phabricator-notification' => '5c3349b2', 792 + 'phabricator-notification' => '008faf9c', 793 793 'phabricator-notification-css' => '457861ec', 794 794 'phabricator-notification-menu-css' => '10685bd4', 795 795 'phabricator-object-selector-css' => '85ee8ce6', ··· 904 904 'unhandled-exception-css' => '4c96257a', 905 905 ), 906 906 'requires' => array( 907 + '008faf9c' => array( 908 + 'javelin-install', 909 + 'javelin-dom', 910 + 'javelin-stratcom', 911 + 'javelin-util', 912 + 'phabricator-notification-css', 913 + ), 907 914 '013ffff9' => array( 908 915 'javelin-install', 909 916 'javelin-util', ··· 1236 1243 'javelin-uri', 1237 1244 'phabricator-notification', 1238 1245 ), 1246 + '4cc4f460' => array( 1247 + 'javelin-behavior', 1248 + 'javelin-aphlict', 1249 + 'javelin-stratcom', 1250 + 'javelin-request', 1251 + 'javelin-uri', 1252 + 'javelin-dom', 1253 + 'javelin-json', 1254 + 'javelin-router', 1255 + 'javelin-util', 1256 + 'javelin-leader', 1257 + 'javelin-sound', 1258 + 'phabricator-notification', 1259 + ), 1239 1260 '4d863052' => array( 1240 1261 'javelin-dom', 1241 1262 'javelin-util', ··· 1325 1346 'javelin-stratcom', 1326 1347 'javelin-vector', 1327 1348 'javelin-dom', 1328 - ), 1329 - '5c3349b2' => array( 1330 - 'javelin-install', 1331 - 'javelin-dom', 1332 - 'javelin-stratcom', 1333 - 'javelin-util', 1334 - 'phabricator-notification-css', 1335 1349 ), 1336 1350 '5c54cbf3' => array( 1337 1351 'javelin-behavior', ··· 1683 1697 'javelin-workflow', 1684 1698 'javelin-util', 1685 1699 'phabricator-keyboard-shortcut', 1686 - ), 1687 - 'a14cbdfc' => array( 1688 - 'javelin-behavior', 1689 - 'javelin-aphlict', 1690 - 'javelin-stratcom', 1691 - 'javelin-request', 1692 - 'javelin-uri', 1693 - 'javelin-dom', 1694 - 'javelin-json', 1695 - 'javelin-router', 1696 - 'javelin-util', 1697 - 'javelin-leader', 1698 - 'javelin-sound', 1699 - 'phabricator-notification', 1700 1700 ), 1701 1701 'a3a63478' => array( 1702 1702 'phui-workcard-view-css',
+6 -6
src/applications/notification/builder/PhabricatorNotificationBuilder.php
··· 153 153 foreach ($stories as $story) { 154 154 if ($story instanceof PhabricatorApplicationTransactionFeedStory) { 155 155 $dict[] = array( 156 - 'desktopReady' => $desktop_ready, 157 - 'webReady' => $web_ready, 156 + 'showAnyNotification' => $web_ready, 157 + 'showDesktopNotification' => $desktop_ready, 158 158 'title' => $story->renderText(), 159 159 'body' => $story->renderTextBody(), 160 160 'href' => $story->getURI(), ··· 162 162 ); 163 163 } else if ($story instanceof PhabricatorNotificationTestFeedStory) { 164 164 $dict[] = array( 165 - 'desktopReady' => $desktop_ready, 166 - 'webReady' => $web_ready, 165 + 'showAnyNotification' => $web_ready, 166 + 'showDesktopNotification' => $desktop_ready, 167 167 'title' => pht('Test Notification'), 168 168 'body' => $story->renderText(), 169 169 'href' => null, ··· 171 171 ); 172 172 } else { 173 173 $dict[] = array( 174 - 'desktopReady' => false, 175 - 'webReady' => false, 174 + 'showWebNotification' => false, 175 + 'showDesktopNotification' => false, 176 176 'title' => null, 177 177 'body' => null, 178 178 'href' => null,
+1 -7
src/applications/notification/controller/PhabricatorNotificationIndividualController.php
··· 38 38 $dict = $builder->buildDict(); 39 39 $data = $dict[0]; 40 40 41 - $response = array( 41 + $response = $data + array( 42 42 'pertinent' => true, 43 43 'primaryObjectPHID' => $story->getPrimaryObjectPHID(), 44 - 'desktopReady' => $data['desktopReady'], 45 - 'webReady' => $data['webReady'], 46 - 'href' => $data['href'], 47 - 'icon' => $data['icon'], 48 - 'title' => $data['title'], 49 - 'body' => $data['body'], 50 44 'content' => hsprintf('%s', $content), 51 45 'uniqueID' => 'story/'.$story->getChronologicalKey(), 52 46 );
+5 -2
webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js
··· 78 78 JX.Stratcom.invoke('notification-panel-update', null, {}); 79 79 var response = e.getData(); 80 80 81 + if (!response.showAnyNotification) { 82 + return; 83 + } 84 + 81 85 // Show the notification itself. 82 86 new JX.Notification() 83 87 .setContent(JX.$H(response.content)) 84 - .setDesktopReady(response.desktopReady) 85 - .setWebReady(response.webReady) 86 88 .setKey(response.primaryObjectPHID) 89 + .setShowAsDesktopNotification(response.showDesktopNotification) 87 90 .setTitle(response.title) 88 91 .setBody(response.body) 89 92 .setHref(response.href)
+4 -15
webroot/rsrc/js/core/Notification.js
··· 26 26 _visible : false, 27 27 _hideTimer : null, 28 28 _duration : 12000, 29 - _desktopReady : false, 30 - _webReady : false, 29 + _asDesktop : false, 31 30 _key : null, 32 31 _title : null, 33 32 _body : null, ··· 37 36 show : function() { 38 37 var self = JX.Notification; 39 38 40 - // This person doesn't like any real-time notification 41 - if (!this._desktopReady && !this._webReady) { 42 - return; 43 - } 44 - 45 39 if (!this._visible) { 46 40 this._visible = true; 47 41 ··· 51 45 52 46 if (self.supportsDesktopNotifications() && 53 47 self.desktopNotificationsEnabled() && 54 - this._desktopReady) { 48 + this._asDesktop) { 55 49 // Note: specifying "tag" means that notifications with matching 56 50 // keys will aggregate. 57 51 var n = new window.Notification(this._title, { ··· 94 88 return this; 95 89 }, 96 90 97 - setDesktopReady : function(ready) { 98 - this._desktopReady = ready; 99 - return this; 100 - }, 101 - 102 - setWebReady : function(ready) { 103 - this._webReady = ready; 91 + setShowAsDesktopNotification : function(mode) { 92 + this._asDesktop = mode; 104 93 return this; 105 94 }, 106 95