Add scripts to create myops-getqueryview:
[myops.git] / web / query / views / post-page / map.js
diff --git a/web/query/views/post-page/map.js b/web/query/views/post-page/map.js
new file mode 100644 (file)
index 0000000..7a8c755
--- /dev/null
@@ -0,0 +1,13 @@
+function(doc) {
+  // todo make commonjs
+  // !code helpers/md5.js
+  
+  if (doc.type == "post") {
+    emit([doc._id], doc);
+  } else if (doc.type == "comment") {
+    if (doc.commenter && doc.commenter.email && !doc.commenter.gravatar_url) {
+      doc.commenter.gravatar = hex_md5(doc.commenter.email);      
+    }
+    emit([doc.post_id, doc.created_at], doc);
+  }
+};
\ No newline at end of file