1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Minor tidying of Aphlict code

Summary: Just some housekeeping... mostly just removing some unused variables.

Test Plan: Checked that I was still about to receive notifications from `/notification/status/`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11398
This commit is contained in:
Joshua Spence 2015-01-15 08:08:08 +11:00
parent 7ab5d108a4
commit f55647736a
5 changed files with 63 additions and 74 deletions

View file

@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => '8d1c0f87',
'core.pkg.js' => '27bb3264',
'core.pkg.js' => 'b6a9c22a',
'darkconsole.pkg.js' => '8ab24e01',
'differential.pkg.css' => '8af45893',
'differential.pkg.js' => 'dad3622f',
@ -342,10 +342,10 @@ return array(
'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' => '464d333a',
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'f6bc26f0',
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '1162a152',
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => '58f7803f',
'rsrc/js/application/aphlict/Aphlict.js' => 'b300dac3',
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '335470d7',
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '62998733',
'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',
'rsrc/js/application/conpherence/behavior-menu.js' => 'f0a41b9f',
@ -535,11 +535,11 @@ return array(
'herald-rule-editor' => '335fd41f',
'herald-test-css' => '778b008e',
'inline-comment-summary-css' => '8cfd34e8',
'javelin-aphlict' => '464d333a',
'javelin-aphlict' => 'b300dac3',
'javelin-behavior' => '61cbc29a',
'javelin-behavior-aphlict-dropdown' => 'f6bc26f0',
'javelin-behavior-aphlict-listen' => '1162a152',
'javelin-behavior-aphlict-status' => '58f7803f',
'javelin-behavior-aphlict-dropdown' => '335470d7',
'javelin-behavior-aphlict-listen' => '62998733',
'javelin-behavior-aphlict-status' => 'ea681761',
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
'javelin-behavior-aphront-crop' => 'fa0f4fc2',
'javelin-behavior-aphront-drag-and-drop-textarea' => '92eb531d',
@ -902,18 +902,6 @@ return array(
'javelin-install',
'javelin-util',
),
'1162a152' => array(
'javelin-behavior',
'javelin-aphlict',
'javelin-stratcom',
'javelin-request',
'javelin-uri',
'javelin-dom',
'javelin-json',
'javelin-router',
'javelin-util',
'phabricator-notification',
),
'13c739ea' => array(
'javelin-behavior',
'javelin-stratcom',
@ -1002,6 +990,16 @@ return array(
'javelin-install',
'javelin-typeahead-source',
),
'335470d7' => array(
'javelin-behavior',
'javelin-request',
'javelin-stratcom',
'javelin-vector',
'javelin-dom',
'javelin-uri',
'javelin-behavior-device',
'phabricator-title',
),
'335fd41f' => array(
'multirow-row-manager',
'javelin-install',
@ -1089,13 +1087,6 @@ return array(
'javelin-behavior',
'javelin-dom',
),
'464d333a' => array(
'javelin-install',
'javelin-util',
'javelin-websocket',
'javelin-leader',
'javelin-json',
),
'469c0d9e' => array(
'javelin-behavior',
'javelin-dom',
@ -1173,12 +1164,6 @@ return array(
'javelin-vector',
'javelin-dom',
),
'58f7803f' => array(
'javelin-behavior',
'javelin-aphlict',
'phabricator-phtize',
'javelin-dom',
),
'59b251eb' => array(
'javelin-behavior',
'javelin-stratcom',
@ -1227,6 +1212,18 @@ return array(
'javelin-magical-init',
'javelin-util',
),
62998733 => array(
'javelin-behavior',
'javelin-aphlict',
'javelin-stratcom',
'javelin-request',
'javelin-uri',
'javelin-dom',
'javelin-json',
'javelin-router',
'javelin-util',
'phabricator-notification',
),
'6453c869' => array(
'javelin-install',
'javelin-dom',
@ -1584,6 +1581,13 @@ return array(
'javelin-dom',
'phortune-credit-card-form',
),
'b300dac3' => array(
'javelin-install',
'javelin-util',
'javelin-websocket',
'javelin-leader',
'javelin-json',
),
'b3a4b884' => array(
'javelin-behavior',
'phabricator-prefab',
@ -1839,6 +1843,12 @@ return array(
'javelin-dom',
'phabricator-draggable-list',
),
'ea681761' => array(
'javelin-behavior',
'javelin-aphlict',
'phabricator-phtize',
'javelin-dom',
),
'efe49472' => array(
'javelin-install',
'javelin-util',
@ -1892,16 +1902,6 @@ return array(
'javelin-util',
'javelin-reactor',
),
'f6bc26f0' => array(
'javelin-behavior',
'javelin-request',
'javelin-stratcom',
'javelin-vector',
'javelin-dom',
'javelin-uri',
'javelin-behavior-device',
'phabricator-title',
),
'f7379f45' => array(
'javelin-behavior',
'javelin-dom',

View file

@ -36,13 +36,12 @@ JX.install('Aphlict', {
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 @@ JX.install('Aphlict', {
},
_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 @@ JX.install('Aphlict', {
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 @@ JX.install('Aphlict', {
});
}
break;
case 'aphlict.server':
var handler = this.getHandler();
handler && handler(message.data);

View file

@ -37,7 +37,8 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
true);
}
if (request) { //already fetching
if (request) {
// Already fetching.
return;
}
@ -110,7 +111,6 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
}
});
JX.DOM.listen(
bubble,
'click',

View file

@ -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 @@ JX.behavior('aphlict-listen', function(config) {
var request = new JX.Request(
'/notification/individual/',
onnotification);
onNotification);
var routable = request
.addData({key: message.key})
@ -38,16 +37,14 @@ JX.behavior('aphlict-listen', function(config) {
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 @@ JX.behavior('aphlict-listen', function(config) {
.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 @@ JX.behavior('aphlict-listen', function(config) {
config.subscriptions);
client
.setHandler(onaphlictmessage)
.setHandler(onAphlictMessage)
.start();
});

View file

@ -23,19 +23,11 @@ JX.behavior('aphlict-status', function(config) {
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} : {}
className: 'aphlict-connection-status-' + status
},
pht(status));