Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F17918797
D12448.id29870.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
10 KB
Referenced Files
None
Subscribers
None
D12448.id29870.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => '5efa6280',
- 'core.pkg.js' => '6a4f677f',
+ 'core.pkg.js' => 'b0f808fe',
'darkconsole.pkg.js' => '8ab24e01',
'differential.pkg.css' => '3500921f',
'differential.pkg.js' => 'c0506961',
@@ -348,9 +348,9 @@
'rsrc/image/texture/table_header.png' => '5c433037',
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
- 'rsrc/js/application/aphlict/Aphlict.js' => '2be71d56',
+ 'rsrc/js/application/aphlict/Aphlict.js' => '3d4d9ba0',
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '00def500',
- 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'bdf2226d',
+ 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '2e44137d',
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
@@ -545,10 +545,10 @@
'herald-test-css' => '778b008e',
'homepage-panel-css' => 'e34bf140',
'inline-comment-summary-css' => 'eb5f8e8c',
- 'javelin-aphlict' => '2be71d56',
+ 'javelin-aphlict' => '3d4d9ba0',
'javelin-behavior' => '61cbc29a',
'javelin-behavior-aphlict-dropdown' => '00def500',
- 'javelin-behavior-aphlict-listen' => 'bdf2226d',
+ 'javelin-behavior-aphlict-listen' => '2e44137d',
'javelin-behavior-aphlict-status' => 'ea681761',
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
'javelin-behavior-aphront-crop' => 'fa0f4fc2',
@@ -1031,13 +1031,6 @@
'2bb920b6' => array(
'javelin-install',
),
- '2be71d56' => array(
- 'javelin-install',
- 'javelin-util',
- 'javelin-websocket',
- 'javelin-leader',
- 'javelin-json',
- ),
'2bfa2836' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1053,6 +1046,20 @@
'javelin-install',
'javelin-event',
),
+ '2e44137d' => 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',
+ ),
'316b8fa1' => array(
'javelin-install',
'javelin-typeahead-source',
@@ -1076,6 +1083,13 @@
'javelin-util',
'javelin-uri',
),
+ '3d4d9ba0' => array(
+ 'javelin-install',
+ 'javelin-util',
+ 'javelin-websocket',
+ 'javelin-leader',
+ 'javelin-json',
+ ),
'3ee3408b' => array(
'javelin-behavior',
'javelin-behavior-device',
@@ -1724,20 +1738,6 @@
'javelin-util',
'javelin-request',
),
- 'bdf2226d' => 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',
- ),
'be807912' => array(
'javelin-behavior',
'javelin-dom',
diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php
--- a/src/view/page/PhabricatorStandardPageView.php
+++ b/src/view/page/PhabricatorStandardPageView.php
@@ -447,7 +447,16 @@
parent::getTail(),
);
+ $this->initNotificationsListener();
$response = CelerityAPI::getStaticResourceResponse();
+ $tail[] = $response->renderHTMLFooter();
+
+ return $tail;
+ }
+
+ private function initNotificationsListener() {
+ $request = $this->getRequest();
+ $user = $request->getUser();
if (PhabricatorEnv::getEnvConfig('notification.enabled')) {
if ($user && $user->isLoggedIn()) {
@@ -480,10 +489,6 @@
));
}
}
-
- $tail[] = $response->renderHTMLFooter();
-
- return $tail;
}
protected function getBodyClasses() {
@@ -580,6 +585,7 @@
public function renderForQuicksand() {
parent::willRenderPage();
+ $this->initNotificationsListener();
$response = $this->renderPageBodyContent();
$response = $this->willSendResponse($response);
diff --git a/webroot/rsrc/js/application/aphlict/Aphlict.js b/webroot/rsrc/js/application/aphlict/Aphlict.js
--- a/webroot/rsrc/js/application/aphlict/Aphlict.js
+++ b/webroot/rsrc/js/application/aphlict/Aphlict.js
@@ -49,6 +49,14 @@
JX.Leader.call(JX.bind(this, this._begin));
},
+ setSubscriptions: function(subscriptions) {
+ this._subscriptions = subscriptions;
+ JX.Leader.broadcast(
+ null,
+ {type: 'aphlict.subscribe', data: this._subscriptions});
+ return this;
+ },
+
getStatus: function() {
return this._status;
},
diff --git a/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js b/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js
--- a/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js
+++ b/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js
@@ -14,101 +14,120 @@
* phabricator-notification
*/
-JX.behavior('aphlict-listen', function(config) {
- var showing_reload = false;
-
- JX.Stratcom.listen('aphlict-server-message', null, function(e) {
- var message = e.getData();
+JX.behavior('aphlict-listen', function(config, statics) {
+ var showing_reload;
+ statics.page_objects = config.pageObjects;
+ statics.subscriptions = config.subscriptions;
+
+ function setup() {
+ showing_reload = false;
+ JX.Stratcom.listen('aphlict-server-message', null, function(e) {
+ var message = e.getData();
+
+ if (message.type != 'notification') {
+ return;
+ }
+
+ JX.Leader.callIfLeader(function() {
+ var request = new JX.Request(
+ '/notification/individual/',
+ onNotification);
+
+ var routable = request
+ .addData({key: message.key})
+ .getRoutable();
+
+ routable
+ .setType('notification')
+ .setPriority(250);
+
+ JX.Router.getInstance().queue(routable);
+ });
+ });
- if (message.type != 'notification') {
- return;
+ // Respond to a notification from the Aphlict notification server. We send
+ // a request to Phabricator to get notification details.
+ function onAphlictMessage(message) {
+ switch (message.type) {
+ case 'aphlict.server':
+ JX.Stratcom.invoke(
+ 'aphlict-server-message',
+ null,
+ message.data);
+ break;
+
+ case 'notification.individual':
+ JX.Stratcom.invoke(
+ 'aphlict-notification-message',
+ null,
+ message.data);
+ break;
+ }
}
- JX.Leader.callIfLeader(function() {
- var request = new JX.Request(
- '/notification/individual/',
- onNotification);
-
- var routable = request
- .addData({key: message.key})
- .getRoutable();
-
- routable
- .setType('notification')
- .setPriority(250);
-
- JX.Router.getInstance().queue(routable);
- });
- });
-
- // Respond to a notification from the Aphlict notification server. We send
- // a request to Phabricator to get notification details.
- function onAphlictMessage(message) {
- switch (message.type) {
- case 'aphlict.server':
- JX.Stratcom.invoke('aphlict-server-message', null, message.data);
- break;
-
- case 'notification.individual':
- JX.Stratcom.invoke('aphlict-notification-message', null, message.data);
- break;
- }
- }
+ // Respond to a response from Phabricator about a specific notification.
+ function onNotification(response) {
+ if (!response.pertinent) {
+ return;
+ }
- // Respond to a response from Phabricator about a specific notification.
- function onNotification(response) {
- if (!response.pertinent) {
- return;
+ JX.Leader.broadcast(null, {
+ type: 'notification.individual',
+ data: response
+ });
}
- JX.Leader.broadcast(null, {
- type: 'notification.individual',
- data: response
+ JX.Stratcom.listen('aphlict-notification-message', null, function(e) {
+ JX.Stratcom.invoke('notification-panel-update', null, {});
+ var response = e.getData();
+
+ // Show the notification itself.
+ new JX.Notification()
+ .setContent(JX.$H(response.content))
+ .show();
+
+ // If the notification affected an object on this page, show a
+ // permanent reload notification if we aren't already.
+ if ((response.primaryObjectPHID in statics.page_objects) &&
+ !showing_reload) {
+ var reload = new JX.Notification()
+ .setContent('Page updated, click to reload.')
+ .alterClassName('jx-notification-alert', true)
+ .setDuration(0);
+ reload.listen('activate', function() { JX.$U().go(); });
+ reload.show();
+
+ showing_reload = true;
+ }
});
- }
-
- JX.Stratcom.listen('aphlict-notification-message', null, function(e) {
- JX.Stratcom.invoke('notification-panel-update', null, {});
- var response = e.getData();
-
- // Show the notification itself.
- new JX.Notification()
- .setContent(JX.$H(response.content))
- .show();
-
- // If the notification affected an object on this page, show a
- // permanent reload notification if we aren't already.
- if ((response.primaryObjectPHID in config.pageObjects) && !showing_reload) {
- var reload = new JX.Notification()
- .setContent('Page updated, click to reload.')
- .alterClassName('jx-notification-alert', true)
- .setDuration(0);
- reload.listen('activate', function() { JX.$U().go(); });
- reload.show();
-
- showing_reload = true;
- }
- });
- var client = new JX.Aphlict(
- config.websocketURI,
- config.subscriptions);
+ var client = new JX.Aphlict(
+ config.websocketURI,
+ config.subscriptions);
- client
- .setHandler(onAphlictMessage)
- .start();
+ client
+ .setHandler(onAphlictMessage)
+ .start();
- JX.Leader.listen('onReceiveBroadcast', function(message, is_leader) {
- if (message.type !== 'sound') {
- return;
- }
+ JX.Leader.listen('onReceiveBroadcast', function(message, is_leader) {
+ if (message.type !== 'sound') {
+ return;
+ }
- if (!is_leader) {
- return;
- }
+ if (!is_leader) {
+ return;
+ }
- JX.Sound.play(message.data);
- });
+ JX.Sound.play(message.data);
+ });
+ }
+ if (statics.run_setup !== false) {
+ setup();
+ statics.run_setup = false;
+ } else {
+ var client = JX.Aphlict.getInstance();
+ client.setSubscriptions(statics.subscriptions);
+ }
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 31, 1:40 AM (5 d, 33 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8752701
Default Alt Text
D12448.id29870.diff (10 KB)
Attached To
Mode
D12448: Quicksand - make page object notifications work properly with quicksand
Attached
Detach File
Event Timeline
Log In to Comment