couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [couchdb-fauxton] branch master updated: Fix could not bulk delete from table view (#1011)
Date Wed, 01 Nov 2017 13:08:56 GMT
This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git


The following commit(s) were added to refs/heads/master by this push:
     new 5d6170c  Fix could not bulk delete from table view (#1011)
5d6170c is described below

commit 5d6170c21e702f7fcb07077200c797430d198d17
Author: garren smith <garren.smith@gmail.com>
AuthorDate: Wed Nov 1 15:08:54 2017 +0200

    Fix could not bulk delete from table view (#1011)
    
    Fixed an issue where the _rev was not getting added to the doc so table
    view could not do bulk deletes
---
 app/addons/documents/__tests__/shared-helpers.test.js        | 10 ++++++++++
 app/addons/documents/index-results/helpers/shared-helpers.js |  5 ++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/app/addons/documents/__tests__/shared-helpers.test.js b/app/addons/documents/__tests__/shared-helpers.test.js
index 80308e5..9f2d5ff 100644
--- a/app/addons/documents/__tests__/shared-helpers.test.js
+++ b/app/addons/documents/__tests__/shared-helpers.test.js
@@ -231,6 +231,16 @@ describe('Docs Shared Helpers', () => {
       expect(getDocRev(docView, docType)).toBe(docView.value.rev);
     });
 
+    it('returns document revision for docType "view" and only doc', () => {
+      const docView = {
+        id: "20c76d4ff9851694792654ab3e2ca303",
+        _rev: "1-c59f5770929653147ab939344b84e933"
+      };
+      const docType = Constants.INDEX_RESULTS_DOC_TYPE.VIEW;
+      expect(getDocRev(docView, docType)).toBe(docView._rev);
+    });
+
+
     it('returns document revision for docType "MangoQueryResult"', () => {
       const docMangoResult = {
         _id: "aardvark",
diff --git a/app/addons/documents/index-results/helpers/shared-helpers.js b/app/addons/documents/index-results/helpers/shared-helpers.js
index 175e04b..86d139b 100644
--- a/app/addons/documents/index-results/helpers/shared-helpers.js
+++ b/app/addons/documents/index-results/helpers/shared-helpers.js
@@ -96,7 +96,10 @@ const getDocId = (doc, docType = Constants.INDEX_RESULTS_DOC_TYPE.VIEW)
=> {
 
 const getDocRev = (doc, docType = Constants.INDEX_RESULTS_DOC_TYPE.VIEW) => {
   if (docType === Constants.INDEX_RESULTS_DOC_TYPE.VIEW) {
-    return doc.value && doc.value.rev;
+    if (doc.value) {
+      return doc.value.rev;
+    }
+    return doc._rev;
   } else if (docType === Constants.INDEX_RESULTS_DOC_TYPE.MANGO_INDEX) {
     return undefined;
   } else if (docType === Constants.INDEX_RESULTS_DOC_TYPE.MANGO_QUERY) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message