From 1466563673ffe6c41ec9a18bf98565b8562ee4f3 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 15 Dec 2017 02:43:51 +0100 Subject: thread_users hackery --- bucky/app/bucky.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'bucky/app/bucky.js') diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js index cf74ec2..1b14f43 100644 --- a/bucky/app/bucky.js +++ b/bucky/app/bucky.js @@ -201,7 +201,25 @@ var bucky = module.exports = { res.thread.set('settings', settings) res.thread.save().then( () => next() ) }, - + ensureInterestedUsers: function(req, res, next){ + // given a thread, find people who might be interested in it + // - other people who have been in threads with you + // - other people who have posted on the keyword + // for now though, just show the last 20 people who have logged in.. + db.getLastlog(21).then( (users) => { + res.interestedUsers = users + next() + }).catch( () => { + res.interestedUsers = [] + next() + }) + }, + ensureThreadUsers: function(req, res, next) { + db.getThreadUsers(res.thread.get('id')).then(thread_users => { + res.thread_users = thread_users + next() + }) + }, destroyThread: function (req, res, next) { console.log(">>> destroying thread", res.thread.get('id')) var commentPromises = res.comments.map((comment) => { -- cgit v1.2.3-70-g09d2