diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-09-06 01:31:50 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-09-06 01:31:50 -0400 |
| commit | c88806506d2f8845a9fb914c960d0b6bbc5a8e1e (patch) | |
| tree | c271bb35972175d286f62ecfce76a8fce50f6aa7 /lib/db/index.js | |
| parent | 0d0c04ad510264f2dbd2deb3bbf0b0d0c0605a62 (diff) | |
display hootbox
Diffstat (limited to 'lib/db/index.js')
| -rw-r--r-- | lib/db/index.js | 17 |
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 |
