couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [4/5] fauxton commit: updated refs/heads/master to d138e01
Date Fri, 28 Aug 2015 16:59:29 GMT
remove superfluous JSON.parse call

always request JSON, the current call will crash when the response
is already json encoded

PR: #504
PR-URL: https://github.com/apache/couchdb-fauxton/pull/504
Reviewed-By: Benjamin Keen <ben.keen@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/d138e019
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/d138e019
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/d138e019

Branch: refs/heads/master
Commit: d138e0197c99bf4ddf5a8b4a326d05e81fbb55b7
Parents: 7a58327
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Fri Aug 28 17:31:20 2015 +0200
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Fri Aug 28 18:59:10 2015 +0200

----------------------------------------------------------------------
 app/addons/documents/changes/actions.js                      | 6 ++----
 .../documents/changes/tests/changes.componentsSpec.react.jsx | 8 ++++----
 2 files changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/d138e019/app/addons/documents/changes/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/changes/actions.js b/app/addons/documents/changes/actions.js
index 8a75566..e5b127a 100644
--- a/app/addons/documents/changes/actions.js
+++ b/app/addons/documents/changes/actions.js
@@ -70,13 +70,11 @@ function (app, FauxtonAPI, ActionTypes, Stores, Helpers) {
       var db = app.utils.safeURLName(changesStore.getDatabaseName());
 
       var endpoint = FauxtonAPI.urls('changes', 'server', db, '');
-      currentRequest = $.get(endpoint);
+      currentRequest = $.getJSON(endpoint);
       currentRequest.then(_.bind(this.updateChanges, this));
     },
 
-    updateChanges: function (resp) {
-      var json = JSON.parse(resp);
-
+    updateChanges: function (json) {
       // only bother updating the list of changes if the seq num has changed
       var latestSeqNum = Helpers.getSeqNum(json.last_seq);
       if (latestSeqNum !== changesStore.getLastSeqNum()) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/d138e019/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx b/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
index 049e95c..7a3e444 100644
--- a/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
+++ b/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
@@ -203,10 +203,10 @@ define([
       { id: 'doc_4', seq: 7, deleted: false, changes: { code: 'here' } },
       { id: 'doc_5', seq: 1, deleted: true, changes: { code: 'here' } }
     ];
-    var changesResponse = JSON.stringify({
+    var changesResponse = {
       last_seq: 123,
       'results': results
-    });
+    };
 
     beforeEach(function () {
       container = document.createElement('div');
@@ -304,10 +304,10 @@ define([
         changes.push({ id: 'doc_' + i, seq: 1, changes: { code: 'here' } });
       });
 
-      var response = JSON.stringify({
+      var response = {
         last_seq: 1,
         results: changes
-      });
+      };
 
       Actions.initChanges({ databaseName: 'test' });
 


Mime
View raw message