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

Correct the behavior of "Desktop Only" in Notifications preferences

Summary:
See <https://discourse.phabricator-community.org/t/desktop-only-notifications-mode-is-broken/1234>. Ref T13102. The "Desktop Only" mode for notifications currently shows both desktop and web notifications.

In fact, `JX.Notification` currently has no ability to render notifications as desktop-only. Make this work.

Note that many of the variables and parameters here, including `showAnyNotification`, `web_ready`, and `desktop_ready`, are named in an incorrect or misleading way. However, the new behavior appears to be correct.

Test Plan:
- Emitted test notifications in "No Notifications", "Web Only", "Web and Desktop", and "Desktop" modes.
- Saw appropriate notifications appear in the UI.

Maniphest Tasks: T13102

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

+41 -27
+26 -26
resources/celerity/map.php
··· 10 10 'conpherence.pkg.css' => 'e68cf1fa', 11 11 'conpherence.pkg.js' => '15191c65', 12 12 'core.pkg.css' => 'c218ed53', 13 - 'core.pkg.js' => '0fabde4f', 13 + 'core.pkg.js' => '8581cd02', 14 14 'differential.pkg.css' => '113e692c', 15 15 'differential.pkg.js' => 'f6d809c0', 16 16 'diffusion.pkg.css' => 'a2d17c7d', ··· 352 352 'rsrc/image/texture/table_header_tall.png' => 'd56b434f', 353 353 'rsrc/js/application/aphlict/Aphlict.js' => 'e1d4b11a', 354 354 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'caade6f2', 355 - 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '4cc4f460', 355 + 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '599a8f5f', 356 356 'rsrc/js/application/aphlict/behavior-aphlict-status.js' => '5e2634b9', 357 357 'rsrc/js/application/aphlict/behavior-desktop-notifications-control.js' => '27ca6289', 358 358 'rsrc/js/application/calendar/behavior-day-view.js' => '4b3c4443', ··· 445 445 'rsrc/js/core/KeyboardShortcut.js' => '1ae869f2', 446 446 'rsrc/js/core/KeyboardShortcutManager.js' => 'c19dd9b9', 447 447 'rsrc/js/core/MultirowRowManager.js' => 'b5d57730', 448 - 'rsrc/js/core/Notification.js' => '008faf9c', 448 + 'rsrc/js/core/Notification.js' => '4f774dac', 449 449 'rsrc/js/core/Prefab.js' => '77b0ae28', 450 450 'rsrc/js/core/ShapedRequest.js' => '7cbe244b', 451 451 'rsrc/js/core/TextAreaUtils.js' => '320810c8', ··· 566 566 'javelin-aphlict' => 'e1d4b11a', 567 567 'javelin-behavior' => '61cbc29a', 568 568 'javelin-behavior-aphlict-dropdown' => 'caade6f2', 569 - 'javelin-behavior-aphlict-listen' => '4cc4f460', 569 + 'javelin-behavior-aphlict-listen' => '599a8f5f', 570 570 'javelin-behavior-aphlict-status' => '5e2634b9', 571 571 'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884', 572 572 'javelin-behavior-aphront-drag-and-drop-textarea' => '484a6e22', ··· 772 772 'phabricator-keyboard-shortcut-manager' => 'c19dd9b9', 773 773 'phabricator-main-menu-view' => '1802a242', 774 774 'phabricator-nav-view-css' => 'a9e3e6d5', 775 - 'phabricator-notification' => '008faf9c', 775 + 'phabricator-notification' => '4f774dac', 776 776 'phabricator-notification-css' => '457861ec', 777 777 'phabricator-notification-menu-css' => '10685bd4', 778 778 'phabricator-object-selector-css' => '85ee8ce6', ··· 894 894 'javelin-typeahead-preloaded-source', 895 895 'javelin-util', 896 896 ), 897 - '008faf9c' => array( 898 - 'javelin-install', 899 - 'javelin-dom', 900 - 'javelin-stratcom', 901 - 'javelin-util', 902 - 'phabricator-notification-css', 903 - ), 904 897 '013ffff9' => array( 905 898 'javelin-install', 906 899 'javelin-util', ··· 1259 1252 'javelin-uri', 1260 1253 'phabricator-notification', 1261 1254 ), 1262 - '4cc4f460' => array( 1263 - 'javelin-behavior', 1264 - 'javelin-aphlict', 1265 - 'javelin-stratcom', 1266 - 'javelin-request', 1267 - 'javelin-uri', 1268 - 'javelin-dom', 1269 - 'javelin-json', 1270 - 'javelin-router', 1271 - 'javelin-util', 1272 - 'javelin-leader', 1273 - 'javelin-sound', 1274 - 'phabricator-notification', 1275 - ), 1276 1255 '4d863052' => array( 1277 1256 'javelin-dom', 1278 1257 'javelin-util', ··· 1288 1267 'javelin-behavior', 1289 1268 'javelin-stratcom', 1290 1269 'javelin-dom', 1270 + ), 1271 + '4f774dac' => array( 1272 + 'javelin-install', 1273 + 'javelin-dom', 1274 + 'javelin-stratcom', 1275 + 'javelin-util', 1276 + 'phabricator-notification-css', 1291 1277 ), 1292 1278 '503e17fd' => array( 1293 1279 'javelin-install', ··· 1342 1328 'javelin-dom', 1343 1329 'javelin-uri', 1344 1330 'phabricator-file-upload', 1331 + ), 1332 + '599a8f5f' => array( 1333 + 'javelin-behavior', 1334 + 'javelin-aphlict', 1335 + 'javelin-stratcom', 1336 + 'javelin-request', 1337 + 'javelin-uri', 1338 + 'javelin-dom', 1339 + 'javelin-json', 1340 + 'javelin-router', 1341 + 'javelin-util', 1342 + 'javelin-leader', 1343 + 'javelin-sound', 1344 + 'phabricator-notification', 1345 1345 ), 1346 1346 '59a7976a' => array( 1347 1347 'javelin-install',
+2 -1
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) { 81 + if (!response.showAnyNotification && !response.showDesktopNotification) { 82 82 return; 83 83 } 84 84 ··· 86 86 new JX.Notification() 87 87 .setContent(JX.$H(response.content)) 88 88 .setKey(response.primaryObjectPHID) 89 + .setShowAsWebNotification(response.showAnyNotification) 89 90 .setShowAsDesktopNotification(response.showDesktopNotification) 90 91 .setTitle(response.title) 91 92 .setBody(response.body)
+13
webroot/rsrc/js/core/Notification.js
··· 27 27 _hideTimer : null, 28 28 _duration : 12000, 29 29 _asDesktop : false, 30 + _asWeb : true, 30 31 _key : null, 31 32 _title : null, 32 33 _body : null, ··· 85 86 86 87 setContent : function(content) { 87 88 JX.DOM.setContent(this._getContainer(), content); 89 + return this; 90 + }, 91 + 92 + setShowAsWebNotification: function(mode) { 93 + this._asWeb = mode; 88 94 return this; 89 95 }, 90 96 ··· 242 248 243 249 var notifications = []; 244 250 for (var ii = 0; ii < self._active.length; ii++) { 251 + 252 + // Don't render this notification if it's not configured to show as 253 + // a web notification. 254 + if (!self._active[ii]._asWeb) { 255 + continue; 256 + } 257 + 245 258 notifications.push(self._active[ii]._getContainer()); 246 259 if (!(--limit)) { 247 260 break;