← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/launchpad/longpoll-javascript-event-data into lp:launchpad

 

Gavin Panella has proposed merging lp:~allenap/launchpad/longpoll-javascript-event-data into lp:launchpad with lp:~allenap/launchpad/longpoll-merge-diff as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~allenap/launchpad/longpoll-javascript-event-data/+merge/77187

There is no longer a distinct event_data key in the event JSON delivered to the browser.
-- 
https://code.launchpad.net/~allenap/launchpad/longpoll-javascript-event-data/+merge/77187
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/longpoll-javascript-event-data into lp:launchpad.
=== modified file 'lib/lp/app/longpoll/javascript/longpoll.js'
--- lib/lp/app/longpoll/javascript/longpoll.js	2011-07-11 10:11:14 +0000
+++ lib/lp/app/longpoll/javascript/longpoll.js	2011-09-27 15:29:27 +0000
@@ -79,9 +79,7 @@
     successPoll : function (id, response) {
         try {
             var data = Y.JSON.parse(response.responseText);
-            var event_key = data.event_key;
-            var event_data = data.event_data;
-            Y.fire(event_key, event_data);
+            Y.fire(data.event_key, data);
             return true;
         }
         catch (e) {

=== modified file 'lib/lp/app/longpoll/javascript/tests/test_longpoll.js'
--- lib/lp/app/longpoll/javascript/tests/test_longpoll.js	2011-07-08 05:12:39 +0000
+++ lib/lp/app/longpoll/javascript/tests/test_longpoll.js	2011-09-27 15:29:27 +0000
@@ -129,7 +129,7 @@
         testSuccessPollMalformedData: function() {
             var manager = longpoll.getLongPollManager();
             var response = {
-                responseText: '{ "event_data": "6" }'
+                responseText: '{ "something": "6" }'
             };
             var res = manager.successPoll("2", response);
             Y.Assert.isFalse(res);
@@ -138,7 +138,7 @@
          testSuccessPollWellformedData: function() {
             var manager = longpoll.getLongPollManager();
             var response = {
-                responseText: '{ "event_key": "4", "event_data": "6"}'
+                responseText: '{ "event_key": "4", "something": "6"}'
             };
             var res = manager.successPoll("2", response);
             Y.Assert.isTrue(res);
@@ -231,15 +231,14 @@
         testPollPayLoadOk: function() {
             // Create a valid message.
             var custom_event = 'my-event';
-            var custom_payload = {5: 'i'};
             var custom_response = {
                 'event_key': custom_event,
-                'event_data': custom_payload
+                'something': {something_else: 1234}
             };
             var fired = false;
             Y.on(custom_event, function(data) {
                 fired = true;
-                Y.Assert.areEqual(data, custom_payload);
+                Y.Assert.areEqual(data, custom_response);
             });
             var manager = longpoll.getLongPollManager();
             // Monkeypatch io.