mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +01:00
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
This commit is contained in:
parent
6cedd4a95c
commit
29f625ef68
5 changed files with 42 additions and 56 deletions
|
@ -10,7 +10,7 @@ return array(
|
|||
'conpherence.pkg.css' => 'e68cf1fa',
|
||||
'conpherence.pkg.js' => 'b5b51108',
|
||||
'core.pkg.css' => 'e9473020',
|
||||
'core.pkg.js' => '6c085267',
|
||||
'core.pkg.js' => '28552e58',
|
||||
'darkconsole.pkg.js' => '1f9a31bc',
|
||||
'differential.pkg.css' => '45951e9e',
|
||||
'differential.pkg.js' => 'b71b8c5d',
|
||||
|
@ -374,7 +374,7 @@ return array(
|
|||
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
|
||||
'rsrc/js/application/aphlict/Aphlict.js' => 'e1d4b11a',
|
||||
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'caade6f2',
|
||||
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'a14cbdfc',
|
||||
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '4cc4f460',
|
||||
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => '5e2634b9',
|
||||
'rsrc/js/application/aphlict/behavior-desktop-notifications-control.js' => '27ca6289',
|
||||
'rsrc/js/application/calendar/behavior-day-view.js' => '4b3c4443',
|
||||
|
@ -467,7 +467,7 @@ return array(
|
|||
'rsrc/js/core/KeyboardShortcut.js' => '1ae869f2',
|
||||
'rsrc/js/core/KeyboardShortcutManager.js' => 'c19dd9b9',
|
||||
'rsrc/js/core/MultirowRowManager.js' => 'b5d57730',
|
||||
'rsrc/js/core/Notification.js' => '5c3349b2',
|
||||
'rsrc/js/core/Notification.js' => '008faf9c',
|
||||
'rsrc/js/core/Prefab.js' => 'c5af80a2',
|
||||
'rsrc/js/core/ShapedRequest.js' => '7cbe244b',
|
||||
'rsrc/js/core/TextAreaUtils.js' => '320810c8',
|
||||
|
@ -585,7 +585,7 @@ return array(
|
|||
'javelin-aphlict' => 'e1d4b11a',
|
||||
'javelin-behavior' => '61cbc29a',
|
||||
'javelin-behavior-aphlict-dropdown' => 'caade6f2',
|
||||
'javelin-behavior-aphlict-listen' => 'a14cbdfc',
|
||||
'javelin-behavior-aphlict-listen' => '4cc4f460',
|
||||
'javelin-behavior-aphlict-status' => '5e2634b9',
|
||||
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
|
||||
'javelin-behavior-aphront-drag-and-drop-textarea' => '484a6e22',
|
||||
|
@ -789,7 +789,7 @@ return array(
|
|||
'phabricator-keyboard-shortcut-manager' => 'c19dd9b9',
|
||||
'phabricator-main-menu-view' => '1802a242',
|
||||
'phabricator-nav-view-css' => 'faf6a6fc',
|
||||
'phabricator-notification' => '5c3349b2',
|
||||
'phabricator-notification' => '008faf9c',
|
||||
'phabricator-notification-css' => '457861ec',
|
||||
'phabricator-notification-menu-css' => '10685bd4',
|
||||
'phabricator-object-selector-css' => '85ee8ce6',
|
||||
|
@ -904,6 +904,13 @@ return array(
|
|||
'unhandled-exception-css' => '4c96257a',
|
||||
),
|
||||
'requires' => array(
|
||||
'008faf9c' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'javelin-util',
|
||||
'phabricator-notification-css',
|
||||
),
|
||||
'013ffff9' => array(
|
||||
'javelin-install',
|
||||
'javelin-util',
|
||||
|
@ -1236,6 +1243,20 @@ return array(
|
|||
'javelin-uri',
|
||||
'phabricator-notification',
|
||||
),
|
||||
'4cc4f460' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-aphlict',
|
||||
'javelin-stratcom',
|
||||
'javelin-request',
|
||||
'javelin-uri',
|
||||
'javelin-dom',
|
||||
'javelin-json',
|
||||
'javelin-router',
|
||||
'javelin-util',
|
||||
'javelin-leader',
|
||||
'javelin-sound',
|
||||
'phabricator-notification',
|
||||
),
|
||||
'4d863052' => array(
|
||||
'javelin-dom',
|
||||
'javelin-util',
|
||||
|
@ -1326,13 +1347,6 @@ return array(
|
|||
'javelin-vector',
|
||||
'javelin-dom',
|
||||
),
|
||||
'5c3349b2' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'javelin-util',
|
||||
'phabricator-notification-css',
|
||||
),
|
||||
'5c54cbf3' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
@ -1684,20 +1698,6 @@ return array(
|
|||
'javelin-util',
|
||||
'phabricator-keyboard-shortcut',
|
||||
),
|
||||
'a14cbdfc' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-aphlict',
|
||||
'javelin-stratcom',
|
||||
'javelin-request',
|
||||
'javelin-uri',
|
||||
'javelin-dom',
|
||||
'javelin-json',
|
||||
'javelin-router',
|
||||
'javelin-util',
|
||||
'javelin-leader',
|
||||
'javelin-sound',
|
||||
'phabricator-notification',
|
||||
),
|
||||
'a3a63478' => array(
|
||||
'phui-workcard-view-css',
|
||||
),
|
||||
|
|
|
@ -153,8 +153,8 @@ final class PhabricatorNotificationBuilder extends Phobject {
|
|||
foreach ($stories as $story) {
|
||||
if ($story instanceof PhabricatorApplicationTransactionFeedStory) {
|
||||
$dict[] = array(
|
||||
'desktopReady' => $desktop_ready,
|
||||
'webReady' => $web_ready,
|
||||
'showAnyNotification' => $web_ready,
|
||||
'showDesktopNotification' => $desktop_ready,
|
||||
'title' => $story->renderText(),
|
||||
'body' => $story->renderTextBody(),
|
||||
'href' => $story->getURI(),
|
||||
|
@ -162,8 +162,8 @@ final class PhabricatorNotificationBuilder extends Phobject {
|
|||
);
|
||||
} else if ($story instanceof PhabricatorNotificationTestFeedStory) {
|
||||
$dict[] = array(
|
||||
'desktopReady' => $desktop_ready,
|
||||
'webReady' => $web_ready,
|
||||
'showAnyNotification' => $web_ready,
|
||||
'showDesktopNotification' => $desktop_ready,
|
||||
'title' => pht('Test Notification'),
|
||||
'body' => $story->renderText(),
|
||||
'href' => null,
|
||||
|
@ -171,8 +171,8 @@ final class PhabricatorNotificationBuilder extends Phobject {
|
|||
);
|
||||
} else {
|
||||
$dict[] = array(
|
||||
'desktopReady' => false,
|
||||
'webReady' => false,
|
||||
'showWebNotification' => false,
|
||||
'showDesktopNotification' => false,
|
||||
'title' => null,
|
||||
'body' => null,
|
||||
'href' => null,
|
||||
|
|
|
@ -38,15 +38,9 @@ final class PhabricatorNotificationIndividualController
|
|||
$dict = $builder->buildDict();
|
||||
$data = $dict[0];
|
||||
|
||||
$response = array(
|
||||
$response = $data + array(
|
||||
'pertinent' => true,
|
||||
'primaryObjectPHID' => $story->getPrimaryObjectPHID(),
|
||||
'desktopReady' => $data['desktopReady'],
|
||||
'webReady' => $data['webReady'],
|
||||
'href' => $data['href'],
|
||||
'icon' => $data['icon'],
|
||||
'title' => $data['title'],
|
||||
'body' => $data['body'],
|
||||
'content' => hsprintf('%s', $content),
|
||||
'uniqueID' => 'story/'.$story->getChronologicalKey(),
|
||||
);
|
||||
|
|
|
@ -78,12 +78,15 @@ JX.behavior('aphlict-listen', function(config) {
|
|||
JX.Stratcom.invoke('notification-panel-update', null, {});
|
||||
var response = e.getData();
|
||||
|
||||
if (!response.showAnyNotification) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Show the notification itself.
|
||||
new JX.Notification()
|
||||
.setContent(JX.$H(response.content))
|
||||
.setDesktopReady(response.desktopReady)
|
||||
.setWebReady(response.webReady)
|
||||
.setKey(response.primaryObjectPHID)
|
||||
.setShowAsDesktopNotification(response.showDesktopNotification)
|
||||
.setTitle(response.title)
|
||||
.setBody(response.body)
|
||||
.setHref(response.href)
|
||||
|
|
|
@ -26,8 +26,7 @@ JX.install('Notification', {
|
|||
_visible : false,
|
||||
_hideTimer : null,
|
||||
_duration : 12000,
|
||||
_desktopReady : false,
|
||||
_webReady : false,
|
||||
_asDesktop : false,
|
||||
_key : null,
|
||||
_title : null,
|
||||
_body : null,
|
||||
|
@ -37,11 +36,6 @@ JX.install('Notification', {
|
|||
show : function() {
|
||||
var self = JX.Notification;
|
||||
|
||||
// This person doesn't like any real-time notification
|
||||
if (!this._desktopReady && !this._webReady) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this._visible) {
|
||||
this._visible = true;
|
||||
|
||||
|
@ -51,7 +45,7 @@ JX.install('Notification', {
|
|||
|
||||
if (self.supportsDesktopNotifications() &&
|
||||
self.desktopNotificationsEnabled() &&
|
||||
this._desktopReady) {
|
||||
this._asDesktop) {
|
||||
// Note: specifying "tag" means that notifications with matching
|
||||
// keys will aggregate.
|
||||
var n = new window.Notification(this._title, {
|
||||
|
@ -94,13 +88,8 @@ JX.install('Notification', {
|
|||
return this;
|
||||
},
|
||||
|
||||
setDesktopReady : function(ready) {
|
||||
this._desktopReady = ready;
|
||||
return this;
|
||||
},
|
||||
|
||||
setWebReady : function(ready) {
|
||||
this._webReady = ready;
|
||||
setShowAsDesktopNotification : function(mode) {
|
||||
this._asDesktop = mode;
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue