diff options
author | jessib <jessib@riseup.net> | 2014-01-07 12:57:01 -0800 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2014-01-07 12:57:01 -0800 |
commit | c7e66852324714a166dd35dc3d5873a0053dcb9b (patch) | |
tree | 4d306a960fbf1491510573640643f91af8fc208c /users/app/designs/message | |
parent | b920c144ef70613414a702e468ab7889659a03da (diff) |
Some refactoring, to simplify user model, optimize, and allow messages to be sorted by date (although are not now.)
Also, rather than use whenever gem, will have cron job created to call task.
Diffstat (limited to 'users/app/designs/message')
-rw-r--r-- | users/app/designs/message/by_user_ids_to_show.js | 7 | ||||
-rw-r--r-- | users/app/designs/message/by_user_ids_to_show_and_created_at.js | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/users/app/designs/message/by_user_ids_to_show.js b/users/app/designs/message/by_user_ids_to_show.js new file mode 100644 index 0000000..95ccd0d --- /dev/null +++ b/users/app/designs/message/by_user_ids_to_show.js @@ -0,0 +1,7 @@ +function (doc) { + if (doc.type === 'Message' && doc.user_ids_to_show && Array.isArray(doc.user_ids_to_show)) { + doc.user_ids_to_show.forEach(function (userIdsToShow) { + emit(userIdsToShow, 1); + }); + } +}
\ No newline at end of file diff --git a/users/app/designs/message/by_user_ids_to_show_and_created_at.js b/users/app/designs/message/by_user_ids_to_show_and_created_at.js new file mode 100644 index 0000000..7bd7c2c --- /dev/null +++ b/users/app/designs/message/by_user_ids_to_show_and_created_at.js @@ -0,0 +1,8 @@ +// not using at moment +function (doc) { + if (doc.type === 'Message' && doc.user_ids_to_show && Array.isArray(doc.user_ids_to_show)) { + doc.user_ids_to_show.forEach(function (userIdsToShow) { + emit([userIdsToShow, doc.created_at], 1); + }); + } +}
\ No newline at end of file |