summaryrefslogtreecommitdiff
path: root/common/src/leap/soledad/common/ddocs/docs/views/get/map.js
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/leap/soledad/common/ddocs/docs/views/get/map.js')
-rw-r--r--common/src/leap/soledad/common/ddocs/docs/views/get/map.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/common/src/leap/soledad/common/ddocs/docs/views/get/map.js b/common/src/leap/soledad/common/ddocs/docs/views/get/map.js
new file mode 100644
index 00000000..ae08d9e9
--- /dev/null
+++ b/common/src/leap/soledad/common/ddocs/docs/views/get/map.js
@@ -0,0 +1,20 @@
+function(doc) {
+ if (doc.u1db_rev) {
+ var is_tombstone = true;
+ var has_conflicts = false;
+ if (doc._attachments) {
+ if (doc._attachments.u1db_content)
+ is_tombstone = false;
+ if (doc._attachments.u1db_conflicts)
+ has_conflicts = true;
+ }
+ emit(doc._id,
+ {
+ "couch_rev": doc._rev,
+ "u1db_rev": doc.u1db_rev,
+ "is_tombstone": is_tombstone,
+ "has_conflicts": has_conflicts,
+ }
+ );
+ }
+}