summaryrefslogtreecommitdiff
path: root/bucky/app/bucky.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-12 02:09:15 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-12 02:09:15 +0100
commit41d0bd185c19c8a51ed9b85700f52181b6cc5012 (patch)
tree76d4524fff4221da47e57ea0bcdb0917d592b5d1 /bucky/app/bucky.js
parentce73133c4e982db99f218bf930d82eb991ce81e3 (diff)
color stuff, building settings form
Diffstat (limited to 'bucky/app/bucky.js')
-rw-r--r--bucky/app/bucky.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js
index ab30e85..9d8d0a7 100644
--- a/bucky/app/bucky.js
+++ b/bucky/app/bucky.js
@@ -112,6 +112,21 @@ var bucky = module.exports = {
}
})
},
+ prepareThread: function (req, res, next){
+ var thread = res.thread
+ if (thread) {
+ var settings
+ try {
+ settings = JSON.parse(thread.get('settings') || '{}')
+ } catch(e) {
+ settings = {}
+ }
+ res.thread.set("settings", settings)
+ res.thread.set("display", res.thread.get("display").toString())
+ res.thread.set("allowed", res.thread.get("allowed").toString())
+ }
+ next()
+ },
ensureCommentThread: function (req, res, next){
if (! res.comment) {
return res.sendStatus(404)
@@ -135,9 +150,15 @@ var bucky = module.exports = {
if (! keyword) return next()
db.getKeyword(keyword).then(function(keyword){
res.keyword = keyword
+ if (keyword) {
+ keyword.set("threads", keyword.get("threads").toString())
+ keyword.set("ops", keyword.get("ops").toString())
+ keyword.set("display", keyword.get("display").toString())
+ }
next()
})
},
+
ensureCommentsForThread: function (req, res, next){
db.getCommentsForThread(res.thread.get('id')).then(function(comments){
res.comments = comments