From 62d85b0e2681b7748cac342e8855bf43db32e071 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 22 Oct 2014 13:21:37 -0400 Subject: [PATCH] updated installation data to only create four categories by default, and altered colour to be less stark (heh, what does that mean anyway...). Also added an intro post --- install/data/categories.json | 84 +++++------------------------------- src/install.js | 20 ++++++++- src/socket.io/index.js | 5 +++ 3 files changed, 34 insertions(+), 75 deletions(-) diff --git a/install/data/categories.json b/install/data/categories.json index b05be1b708..74b058e80f 100644 --- a/install/data/categories.json +++ b/install/data/categories.json @@ -2,7 +2,7 @@ { "name": "Announcements", "description": "Announcements regarding our community", - "bgColor": "#0059B2", + "bgColor": "#fda34b", "color": "#fff", "icon" : "fa-bullhorn", "order": 1 @@ -10,89 +10,25 @@ { "name": "General Discussion", "description": "A place to talk about whateeeever you want", - "bgColor": "#0059B2", + "bgColor": "#59b3d0", "color": "#fff", - "icon" : "fa-comment", + "icon" : "fa-comments-o", "order": 2 }, - { - "name": "NodeBB Development", - "description": "NodeBB development news and announcements", - "bgColor": "#0059B2", - "color": "#fff", - "icon" : "fa-github", - "order": 3 - }, { "name": "Blogs", "description": "Blog posts from individual members", - "bgColor": "#0059B2", + "bgColor": "#86ba4b", "color": "#fff", - "icon" : "fa-pencil", + "icon" : "fa-newspaper-o", "order": 4 }, { - "name": "Feature Requests", - "description": "Got a feature request you'd like to see? Give us a shout here.", - "bgColor": "#ab1290", - "color": "#fff", - "icon" : "fa-lightbulb-o", - "order": 5 - }, - { - "name": "Bug Reports", - "description": "Having trouble with NodeBB? Let us know...", - "bgColor": "#ab1290", - "color": "#fff", - "icon" : "fa-cogs", - "order": 6 - }, - { - "name": "NodeBB Plugins", - "description": "Enhance your NodeBB with plugins!", - "bgColor": "#ab1290", - "color": "#fff", - "icon" : "fa-plus-square", - "order": 7 - }, - { - "name": "NodeBB Link Exchange", - "description": "Link exchange", - "bgColor": "#ab1290", + "name": "Comments & Feedback", + "description": "Got a question? Ask away!", + "bgColor": "#e95c5a", "color": "#fff", - "icon" : "fa-exchange", - "order": 8 - }, - { - "name": "News", - "description": "News from around the world", - "bgColor": "#004C66", - "color": "#fff", - "icon" : "fa-globe", - "order": 9 - }, - { - "name": "Movies", - "description": "Discuss the latest movies here", - "bgColor": "#004C66", - "color": "#fff", - "icon" : "fa-film", - "order": 10 - }, - { - "name": "Games", - "description": "Discuss the latest games here", - "bgColor": "#004C66", - "color": "#fff", - "icon" : "fa-crosshairs", - "order": 11 - }, - { - "name": "Random", - "description": "Anything and (almost) everything welcome!", - "bgColor": "#004C66", - "color": "#fff", - "icon" : "fa-beer", - "order": 12 + "icon" : "fa-question", + "order": 3 } ] \ No newline at end of file diff --git a/src/install.js b/src/install.js index bdcdd88b27..dabed1ae70 100644 --- a/src/install.js +++ b/src/install.js @@ -398,6 +398,24 @@ function createCategories(next) { }); } +function createWelcomePost(next) { + var db = require('./database'), + Topics = require('./topics'); + + db.sortedSetCard('topics:tid', function(err, numTopics) { + if (numTopics === 0) { + Topics.post({ + uid: 1, + cid: 2, + title: 'Welcome to your NodeBB!', + content: '# Welcome to your brand new NodeBB forum!\n\nThis is what a topic and post looks like. As an administator, you can edit the post\'s title and content.\n\nTo customise your forum, go to the [Administrator Control Panel](../../admin). You can modify all aspects of your forum there, including installation of third-party plugins.\n\n## Additional Resources\n\n* [NodeBB Documentation](https://docs.nodebb.org)\n* [Community Support Forum](https://community.nodebb.org)\n* [Project repository](https://github.com/nodebb/nodebb)' + }, next); + } else { + next(); + } + }); +} + function enableDefaultPlugins(next) { var Plugins = require('./plugins'); @@ -424,7 +442,7 @@ function setCopyrightWidget(next) { } install.setup = function (callback) { - async.series([checkSetupFlag, checkCIFlag, setupConfig, setupDefaultConfigs, enableDefaultTheme, createAdministrator, createCategories, enableDefaultPlugins, setCopyrightWidget, + async.series([checkSetupFlag, checkCIFlag, setupConfig, setupDefaultConfigs, enableDefaultTheme, createAdministrator, createCategories, createWelcomePost, enableDefaultPlugins, setCopyrightWidget, function (next) { require('./upgrade').upgrade(next); } diff --git a/src/socket.io/index.js b/src/socket.io/index.js index 36ebed87db..59aa7d5869 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -352,6 +352,11 @@ Sockets.reqFromSocket = function(socket) { Sockets.isUserOnline = isUserOnline; function isUserOnline(uid) { + if (!io) { + // Special handling for install script (socket.io not initialised) + return false; + } + return Array.isArray(io.sockets.manager.rooms['/uid_' + uid]); }