Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15485192
D11398.id27374.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D11398.id27374.diff
View Options
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
@@ -36,13 +36,12 @@
events: ['didChangeStatus'],
members: {
- _server: null,
- _port: null,
+ _uri: null,
+ _socket: null,
_subscriptions: null,
_status: null,
- _statusCode: null,
- start: function(node, uri) {
+ start: function() {
JX.Leader.listen('onBecomeLeader', JX.bind(this, this._lead));
JX.Leader.listen('onReceiveBroadcast', JX.bind(this, this._receive));
JX.Leader.start();
@@ -64,14 +63,12 @@
},
_lead: function() {
- var socket = new JX.WebSocket(this._uri);
- socket.setOpenHandler(JX.bind(this, this._open));
- socket.setMessageHandler(JX.bind(this, this._message));
- socket.setCloseHandler(JX.bind(this, this._close));
+ this._socket = new JX.WebSocket(this._uri);
+ this._socket.setOpenHandler(JX.bind(this, this._open));
+ this._socket.setMessageHandler(JX.bind(this, this._message));
+ this._socket.setCloseHandler(JX.bind(this, this._close));
- this._socket = socket;
-
- socket.open();
+ this._socket.open();
},
_open: function() {
@@ -97,16 +94,19 @@
case 'aphlict.status':
this._setStatus(message.data);
break;
+
case 'aphlict.getstatus':
if (is_leader) {
this._broadcastStatus(this.getStatus());
}
break;
+
case 'aphlict.getsubscribers':
JX.Leader.broadcast(
null,
{type: 'aphlict.subscribe', data: this._subscriptions});
break;
+
case 'aphlict.subscribe':
if (is_leader) {
this._write({
@@ -115,6 +115,7 @@
});
}
break;
+
case 'aphlict.server':
var handler = this.getHandler();
handler && handler(message.data);
diff --git a/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js b/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js
--- a/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js
+++ b/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js
@@ -37,7 +37,8 @@
true);
}
- if (request) { //already fetching
+ if (request) {
+ // Already fetching.
return;
}
@@ -110,7 +111,6 @@
}
});
-
JX.DOM.listen(
bubble,
'click',
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
@@ -13,7 +13,6 @@
*/
JX.behavior('aphlict-listen', function(config) {
-
var showing_reload = false;
JX.Stratcom.listen('aphlict-receive-message', null, function(e) {
@@ -25,7 +24,7 @@
var request = new JX.Request(
'/notification/individual/',
- onnotification);
+ onNotification);
var routable = request
.addData({key: message.key})
@@ -38,16 +37,14 @@
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) {
+ function onAphlictMessage(message) {
JX.Stratcom.invoke('aphlict-receive-message', null, message);
}
-
// Respond to a response from Phabricator about a specific notification.
- function onnotification(response) {
+ function onNotification(response) {
if (!response.pertinent) {
return;
}
@@ -59,7 +56,6 @@
.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) {
@@ -79,7 +75,7 @@
config.subscriptions);
client
- .setHandler(onaphlictmessage)
+ .setHandler(onAphlictMessage)
.start();
});
diff --git a/webroot/rsrc/js/application/aphlict/behavior-aphlict-status.js b/webroot/rsrc/js/application/aphlict/behavior-aphlict-status.js
--- a/webroot/rsrc/js/application/aphlict/behavior-aphlict-status.js
+++ b/webroot/rsrc/js/application/aphlict/behavior-aphlict-status.js
@@ -23,19 +23,13 @@
return;
}
- var tip = null;
var status = client.getStatus();
-
- if (status == 'error') {
- tip = pht(client.getStatusCode());
- }
-
var status_node = JX.$N(
'span',
{
className: 'aphlict-connection-status-' + status,
- sigil: tip ? 'has-tooltip' : null,
- meta: tip ? {tip: tip, align: 'S', size: 300} : {}
+ sigil: 'has-tooltip',
+ meta: {}
},
pht(status));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 10, 10:26 PM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7725154
Default Alt Text
D11398.id27374.diff (4 KB)
Attached To
Mode
D11398: Minor tidying of Aphlict code
Attached
Detach File
Event Timeline
Log In to Comment