X-Git-Url: http://git.onelab.eu/?p=myops.git;a=blobdiff_plain;f=web%2Fquery%2Fviews%2Fpost-page%2Fmap.js;fp=web%2Fquery%2Fviews%2Fpost-page%2Fmap.js;h=7a8c755696e56d734530601d5b91e0b05a74df82;hp=0000000000000000000000000000000000000000;hb=85070b3d456667f238051af1a2f1f2a0c12300ab;hpb=607f0e13927eb18075c375fa9ba5527da4fcbb44 diff --git a/web/query/views/post-page/map.js b/web/query/views/post-page/map.js new file mode 100644 index 0000000..7a8c755 --- /dev/null +++ b/web/query/views/post-page/map.js @@ -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