From 0b3fa0c838902b3b9d665554aefcb9a72229fa84 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 20 Feb 2014 15:28:37 -0500 Subject: [PATCH] upgrade.js - add recentreplies, activeusers, and moderator widgets to the sidebar as default --- src/upgrade.js | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/upgrade.js b/src/upgrade.js index 2d6f2545d0..e0dc8e1974 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -19,7 +19,7 @@ var db = require('./database'), Upgrade.check = function(callback) { // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema - var latestSchema = new Date(2014, 1, 19, 18, 15).getTime(); + var latestSchema = new Date(2014, 1, 20, 15, 30).getTime(); db.get('schemaDate', function(err, value) { if (parseInt(value, 10) >= latestSchema) { @@ -717,6 +717,34 @@ Upgrade.upgrade = function(callback) { winston.info('[2014/2/19] Updating MOTD to use the HTML widget - skipped'); next(); } + }, + function(next) { + thisSchemaDate = new Date(2014, 1, 20, 15, 30).getTime(); + + if (schemaDate < thisSchemaDate) { + updatesMade = true; + + db.setObjectField('widgets:category.tpl', 'sidebar', JSON.stringify([ + { + "widget": "recentreplies", + "data": {} + }, + { + "widget": "activeusers", + "data": {} + }, + { + "widget": "moderators", + "data": {} + } + ]), function(err) { + winston.info('[2014/2/20] Updated MOTD to use the HTML widget.'); + next(err); + }); + } else { + winston.info('[2014/2/20] Updating MOTD to use the HTML widget - skipped'); + next(); + } } // Add new schema updates here // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!