summaryrefslogtreecommitdiff
path: root/lib/db/index.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-09-06 01:31:50 -0400
committerJules Laplace <jules@okfoc.us>2015-09-06 01:31:50 -0400
commitc88806506d2f8845a9fb914c960d0b6bbc5a8e1e (patch)
treec271bb35972175d286f62ecfce76a8fce50f6aa7 /lib/db/index.js
parent0d0c04ad510264f2dbd2deb3bbf0b0d0c0605a62 (diff)
display hootbox
Diffstat (limited to 'lib/db/index.js')
-rw-r--r--lib/db/index.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/db/index.js b/lib/db/index.js
index 2c8486b..994187e 100644
--- a/lib/db/index.js
+++ b/lib/db/index.js
@@ -83,8 +83,23 @@ db.getCommentsForThread = function (id, limit, offset){
if (offset) {
qb = qb.offset(offset)
}
- }).fetchAll()
+ }).fetchAll().then(function(comments){
+ comments.forEach(function(comment){
+ comment.set("comment", comment.get("comment").toString() )
+ })
+ return comments
+ })
}
db.getCommentCounts = function(ids){
return knex.column('thread').count('* as count').select().from('comments').where('thread', 'in', ids).groupBy('thread')
}
+
+/* PRIVATE MESSAGES */
+
+db.getMessage = function (id){
+ var model = new Message({'id': id})
+ return model.fetch().then(function(message){
+ message.set("body", message.get("body").toString() )
+ return message
+ })
+} \ No newline at end of file