From fc866e47466ac2d214663cf8ab177b8f4698a6c7 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 20 Feb 2014 19:48:08 -0500 Subject: [PATCH] added notice to admins to check out the widgets panel IF motd is not set. upgraded motd to widget for lavender --- src/upgrade.js | 60 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/src/upgrade.js b/src/upgrade.js index 3ae31cf13f..587bf72623 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, 20, 15, 30).getTime(); + var latestSchema = new Date(2014, 1, 20, 19, 45).getTime(); db.get('schemaDate', function(err, value) { if (parseInt(value, 10) >= latestSchema) { @@ -692,27 +692,21 @@ Upgrade.upgrade = function(callback) { if (schemaDate < thisSchemaDate) { updatesMade = true; - if (Meta.config['motd']) { - db.setObjectField('widgets:home.tpl', 'motd', JSON.stringify([ - { - "widget": "html", - "data": { - "html": Meta.config['motd'] - } + db.setObjectField('widgets:home.tpl', 'motd', JSON.stringify([ + { + "widget": "html", + "data": { + "html": Meta.config['motd'] || "Welcome to NodeBB, if you are an administrator of this forum visit the Themes ACP to modify and add widgets." } - ]), function(err) { - Meta.configs.remove('motd'); - Meta.configs.remove('motd_class'); - Meta.configs.remove('show_motd'); - - winston.info('[2014/2/19] Updated MOTD to use the HTML widget.'); - next(err); - }); - } else { - winston.info('[2014/2/19] Updating MOTD to use the HTML widget - skipped'); - next(); - } + } + ]), function(err) { + Meta.configs.remove('motd'); + Meta.configs.remove('motd_class'); + Meta.configs.remove('show_motd'); + winston.info('[2014/2/19] Updated MOTD to use the HTML widget.'); + next(err); + }); } else { winston.info('[2014/2/19] Updating MOTD to use the HTML widget - skipped'); next(); @@ -776,6 +770,32 @@ Upgrade.upgrade = function(callback) { winston.info('[2014/2/20] Adding Forum Stats Widget to the Homepage Footer - skipped'); next(); } + }, + function(next) { + thisSchemaDate = new Date(2014, 1, 20, 19, 45).getTime(); + + if (schemaDate < thisSchemaDate) { + updatesMade = true; + + var container = '
{title}
{body}
'; + + db.setObjectField('widgets:home.tpl', 'sidebar', JSON.stringify([ + { + "widget": "html", + "data": { + "html": Meta.config['motd'] || "Welcome to NodeBB, if you are an administrator of this forum visit the Themes ACP to modify and add widgets.", + "container": container, + "title": "MOTD" + } + } + ]), function(err) { + winston.info('[2014/2/20] Updating Lavender MOTD'); + next(err); + }); + } else { + winston.info('[2014/2/20] Updating Lavender MOTD - skipped'); + next(); + } } // Add new schema updates here // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!