diff --git a/README.md b/README.md index 62a50e06bb..d5d364ffc1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# NodeBB -[![Build Status](https://travis-ci.org/designcreateplay/NodeBB.svg?branch=master)](https://travis-ci.org/designcreateplay/NodeBB) -[![Dependency Status](https://david-dm.org/designcreateplay/nodebb.png)](https://david-dm.org/designcreateplay/nodebb) +# NodeBB +[![Build Status](https://travis-ci.org/NodeBB/NodeBB.svg?branch=master)](https://travis-ci.org/nodebb/nodebb) +[![Dependency Status](https://david-dm.org/nodebb/nodebb.svg)](https://david-dm.org/nodebb/nodebb) [![Code Climate](https://codeclimate.com/github/designcreateplay/NodeBB.png)](https://codeclimate.com/github/designcreateplay/NodeBB) **NodeBB Forum Software** is powered by Node.js and built on a Redis database. It utilizes web sockets for instant interactions and real-time notifications. NodeBB is compatible down to IE8 and has many modern features out of the box such as social network integration and streaming discussions. @@ -25,7 +25,7 @@ Credit: [Convoe](http://www.convoe.com), [Kano](http://www.kano.me), [Manchester ## How can I follow along/contribute? -* Our feature roadmap is hosted on the project wiki's [Version History / Roadmap](https://github.com/designcreateplay/NodeBB/wiki/Version-History-%26-Roadmap) +* Our feature roadmap is hosted on the project wiki's [Version History / Roadmap](https://github.com/NodeBB/NodeBB/wiki/Version-History-%26-Roadmap) * If you are a developer, feel free to check out the source and submit pull requests. We also have a wide array of [plugins](http://community.nodebb.org/category/7/nodebb-plugins) which would be a great starting point for learning the codebase. * If you are a designer, [NodeBB needs themes](http://community.nodebb.org/category/10/nodebb-themes)! NodeBB's theming system allows extention of the base templates as well as styling via LESS or CSS. NodeBB's base theme utilizes [Bootstrap 3](http://getbootstrap.com/) but themes can choose to use a different framework altogether. * Please don't forget to **like**, **follow**, and **star our repo**! Join our growing [community](http://community.nodebb.org) to keep up to date with the latest NodeBB development. @@ -55,4 +55,4 @@ It is important to ensure that your NodeBB and database servers are secured. Bea ## Upgrading NodeBB -Detailed upgrade instructions are listed in [Upgrading NodeBB](https://github.com/designcreateplay/NodeBB/wiki/Upgrading-NodeBB) +Detailed upgrade instructions are listed in [Upgrading NodeBB](https://github.com/NodeBB/NodeBB/wiki/Upgrading-NodeBB) diff --git a/app.js b/app.js index fddded63db..26cdf378cf 100644 --- a/app.js +++ b/app.js @@ -332,7 +332,7 @@ function displayHelp() { winston.info('Options:'); winston.info(' --help displays this usage information'); winston.info(' --setup configure your environment and setup NodeBB'); - winston.info(' --upgrade upgrade NodeBB, first read: github.com/designcreateplay/NodeBB/wiki/Upgrading-NodeBB'); + winston.info(' --upgrade upgrade NodeBB, first read: github.com/NodeBB/NodeBB/wiki/Upgrading-NodeBB'); winston.info(' --reset soft resets NodeBB; disables all plugins and restores selected theme to Vanilla'); winston.info(' --start manually start NodeBB (default when no options are given)'); } diff --git a/docs/configuring/databases/mongo.rst b/docs/configuring/databases/mongo.rst index 922eee9c59..64955a9133 100644 --- a/docs/configuring/databases/mongo.rst +++ b/docs/configuring/databases/mongo.rst @@ -36,7 +36,7 @@ Enter the following into the terminal, replacing `/path/to/nodebb/install/locati .. code:: bash $ cd /path/to/nodebb/install/location - $ git clone git://github.com/designcreateplay/NodeBB.git nodebb + $ git clone git://github.com/NodeBB/NodeBB.git nodebb Step 5: Install The Required NodeBB Dependencies ------------------------- diff --git a/docs/help/help.rst b/docs/help/help.rst index 5bb75b5af9..f951c9df55 100644 --- a/docs/help/help.rst +++ b/docs/help/help.rst @@ -80,7 +80,7 @@ If successful, running the following command should show a version higher than 0 Submit Bugs on our Issue Tracker -------------------------------- -Before reporting bugs, please ensure that the issue has not already been filed on our `tracker `_, or has already been resolved on our `support forum `_. If it has not been filed, feel free to create an account on GitHub and `create a new issue `_. +Before reporting bugs, please ensure that the issue has not already been filed on our `tracker `_, or has already been resolved on our `support forum `_. If it has not been filed, feel free to create an account on GitHub and `create a new issue `_. Ask the NodeBB Community diff --git a/docs/helping/index.rst b/docs/helping/index.rst index d76ca54da4..de31b48803 100644 --- a/docs/helping/index.rst +++ b/docs/helping/index.rst @@ -7,7 +7,7 @@ NodeBB is an open source project, and will forever remain free. Here's a number * `Follow us on Twitter `_ and perhaps tweet **#NodeBB is most awesome forum software @NodeBB** * Update our wiki! ;) We need everything from development/design tutorials to user friendly how-to guides. * Tell everybody about NodeBB, including your grandma and her cats. -* `Submit a pull request, or two, or three.. `_ +* `Submit a pull request, or two, or three.. `_ * Build a new theme * Write a plugin * Keep the link back to us on the footer of your own NodeBB :) @@ -27,7 +27,7 @@ Writing Documentation These docs were written using `Sphinx `_ and published using `rtfd.org `_. -You can edit these docs `directly on GitHub `_, or by clicking on "View page source" on the top right of any page. +You can edit these docs `directly on GitHub `_, or by clicking on "View page source" on the top right of any page. If you wish, you can clone the repository and compile the documentation yourself. Check out the `Getting Started `_ section for more info on how to accomplish the latter. diff --git a/docs/index.rst b/docs/index.rst index c086e5b737..7ec6a0561f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,7 +3,7 @@ | **NodeBB** is a next-generation discussion platform that utilizes web sockets for instant interactions and real-time notifications. NodeBB forums have many modern features out of the box such as social network integration and streaming discussions. -NodeBB is an open source project which can be forked on `GitHub `_. Don't forget to check out the ways that you can help contribute to this project, from translations, pull requests, and telling your friends. +NodeBB is an open source project which can be forked on `GitHub `_. Don't forget to check out the ways that you can help contribute to this project, from translations, pull requests, and telling your friends. Table of Contents ================= diff --git a/docs/installing/cloud/cloud9.rst b/docs/installing/cloud/cloud9.rst index 0e5d2e0594..8a857335ea 100644 --- a/docs/installing/cloud/cloud9.rst +++ b/docs/installing/cloud/cloud9.rst @@ -7,7 +7,7 @@ The following are installation instructions for the `Cloud 9 `_ .. code:: bash - git clone git://github.com/designcreateplay/NodeBB.git nodebb + git clone git://github.com/NodeBB/NodeBB.git nodebb The nodebb command after the git url will create a file called nodebb so you have to CD into the file after you have cloned NodeBB. diff --git a/docs/installing/cloud/heroku.rst b/docs/installing/cloud/heroku.rst index e6aaa6f27a..a5e6c22dbe 100644 --- a/docs/installing/cloud/heroku.rst +++ b/docs/installing/cloud/heroku.rst @@ -6,7 +6,7 @@ Heroku 1. Download and install `Heroku Toolbelt `_ for your operating system 2. Log into your Heroku account: ``heroku login`` 3. Verify your Heroku account by adding a credit card (at http://heroku.com/verify) -4. Clone the repository: ``git clone https://github.com/designcreateplay/NodeBB.git /path/to/repo/clone`` +4. Clone the repository: ``git clone https://github.com/NodeBB/NodeBB.git /path/to/repo/clone`` 5. ``cd /path/to/repo/clone`` 6. Install dependencies locally ``npm install`` 7. Create the heroku app: ``heroku create`` @@ -46,7 +46,7 @@ Heroku 16. Initialise a single dyno: ``heroku ps:scale web=1`` 17. Visit your app! -If these instructions are unclear or if you run into trouble, please let us know by `filing an issue `_. +If these instructions are unclear or if you run into trouble, please let us know by `filing an issue `_. Keeping it up to date --------------------- diff --git a/docs/installing/cloud9.rst b/docs/installing/cloud9.rst index 0e5d2e0594..8a857335ea 100644 --- a/docs/installing/cloud9.rst +++ b/docs/installing/cloud9.rst @@ -7,7 +7,7 @@ The following are installation instructions for the `Cloud 9 `_ .. code:: bash - git clone git://github.com/designcreateplay/NodeBB.git nodebb + git clone git://github.com/NodeBB/NodeBB.git nodebb The nodebb command after the git url will create a file called nodebb so you have to CD into the file after you have cloned NodeBB. diff --git a/docs/installing/heroku.rst b/docs/installing/heroku.rst index 23ad0f0ee3..f484531e3f 100644 --- a/docs/installing/heroku.rst +++ b/docs/installing/heroku.rst @@ -6,7 +6,7 @@ Heroku 1. Download and install `Heroku Toolbelt `_ for your operating system 2. Log into your Heroku account: ``heroku login`` 3. Verify your Heroku account by adding a credit card (at http://heroku.com/verify) -4. Clone the repository: ``git clone https://github.com/designcreateplay/NodeBB.git /path/to/repo/clone`` +4. Clone the repository: ``git clone https://github.com/NodeBB/NodeBB.git /path/to/repo/clone`` 5. ``cd /path/to/repo/clone`` 6. Install dependencies locally ``npm install`` 7. Create the heroku app: ``heroku create`` @@ -32,7 +32,7 @@ Heroku 14. Initialise a single dyno: ``heroku ps:scale web=1`` 15. Visit your app! -If these instructions are unclear or if you run into trouble, please let us know by `filing an issue `_. +If these instructions are unclear or if you run into trouble, please let us know by `filing an issue `_. Keeping it up to date --------------------- diff --git a/docs/installing/os/debian.rst b/docs/installing/os/debian.rst index b1df1d5db1..8c59d7f0f9 100644 --- a/docs/installing/os/debian.rst +++ b/docs/installing/os/debian.rst @@ -139,7 +139,7 @@ Next clone this repository : .. code:: bash $ cd /path/to/nodebb/install/location - $ git clone git://github.com/designcreateplay/NodeBB.git nodebb + $ git clone git://github.com/NodeBB/NodeBB.git nodebb Now we are going to install all dependencies for NodeBB via NPM : @@ -172,6 +172,6 @@ And after all.. let's run the NodeBB forum Extras, tips and Advice ^^^^^^^^^^^^^^^^^^^^^^^ -You should secure your NodeBB installation, `take a look here `_. +You should secure your NodeBB installation, `take a look here `_. You should use Nginx (or similar) in order to reverse proxy your NodeBB installation on the port 80, :doc:`take a look here <../../configuring/proxies>` \ No newline at end of file diff --git a/docs/installing/os/smartos.rst b/docs/installing/os/smartos.rst index cbc194c9c1..c28f4d8457 100644 --- a/docs/installing/os/smartos.rst +++ b/docs/installing/os/smartos.rst @@ -86,7 +86,7 @@ Installation .. code:: bash - $ git clone git://github.com/designcreateplay/NodeBB.git nodebb + $ git clone git://github.com/NodeBB/NodeBB.git nodebb 5. Install NodeBB's npm dependencies: @@ -125,7 +125,7 @@ Installation **Note:** With port 80 the `:80` does not need to be entered. -**Note:** If these instructions are unclear or if you run into trouble, please let us know by `filing an issue `_. +**Note:** If these instructions are unclear or if you run into trouble, please let us know by `filing an issue `_. Upgrading NodeBB ---------------- diff --git a/docs/installing/os/ubuntu.rst b/docs/installing/os/ubuntu.rst index f1a663e0b7..2efd3963ac 100644 --- a/docs/installing/os/ubuntu.rst +++ b/docs/installing/os/ubuntu.rst @@ -26,7 +26,7 @@ Next, clone this repository: .. code:: bash $ cd /path/to/nodebb/install/location - $ git clone git://github.com/designcreateplay/NodeBB.git nodebb + $ git clone git://github.com/NodeBB/NodeBB.git nodebb Obtain all of the dependencies required by NodeBB: diff --git a/docs/installing/os/windows8.rst b/docs/installing/os/windows8.rst index cfb0d41c7a..274254f45a 100644 --- a/docs/installing/os/windows8.rst +++ b/docs/installing/os/windows8.rst @@ -27,7 +27,7 @@ Open Git Shell, and type the following commands. Clone NodeBB repo: .. code:: bash - git clone https://github.com/designcreateplay/NodeBB.git + git clone https://github.com/NodeBB/NodeBB.git Enter directory: diff --git a/docs/plugins/create.rst b/docs/plugins/create.rst index 568c9ece8d..5f5193b8f8 100644 --- a/docs/plugins/create.rst +++ b/docs/plugins/create.rst @@ -16,7 +16,7 @@ There are two types of hooks: **filters** and **actions**. **Actions** are executed at certain points of NodeBB, and are useful if you'd like to *do* something after a certain trigger. For example, an action hook can be used to notify an admin if a certain user has posted. Other uses include analytics recording, or automatic welcome posts on new user registration. -When you are writing your plugin, make sure a hook exists where you'd like something to happen. If a hook isn't present, `file an issue `_ and we'll include it in the next version of NodeBB. +When you are writing your plugin, make sure a hook exists where you'd like something to happen. If a hook isn't present, `file an issue `_ and we'll include it in the next version of NodeBB. Configuration ------------------ diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index 4540cdc822..c8e5267358 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -5,7 +5,7 @@ The following is a list of all hooks present in NodeBB. This list is intended to There are two types of hooks, **filters**, and **actions**. Filters take an input (provided as a single argument), parse it in some way, and return the changed value. Actions take multiple inputs, and execute actions based on the inputs received. Actions do not return anything. -**Important**: This list is by no means exhaustive. Hooks are added on an as-needed basis (or if we can see a potential use case ahead of time), and all requests to add new hooks to NodeBB should be sent to us via the `issue tracker `_. +**Important**: This list is by no means exhaustive. Hooks are added on an as-needed basis (or if we can see a potential use case ahead of time), and all requests to add new hooks to NodeBB should be sent to us via the `issue tracker `_. Filters diff --git a/docs/plugins/settings.rst b/docs/plugins/settings.rst index 7ab7febb53..94e32da115 100644 --- a/docs/plugins/settings.rst +++ b/docs/plugins/settings.rst @@ -299,8 +299,8 @@ All methods get called within Settings-scope. ``trim`` Whether the value is assumed as trimmed. For further impression take a look at the -`default plugins `_. +`default plugins `_. You should also take a look at the helper-functions within -`Settings `_ in order to create +`Settings `_ in order to create your own plugins. There are a few methods that take response to call the methods of other plugins when fittingly. diff --git a/docs/resources.rst b/docs/resources.rst index ae0f398dfc..47984ad9da 100644 --- a/docs/resources.rst +++ b/docs/resources.rst @@ -10,7 +10,7 @@ Developer's Resources Core ---- -* `Building a new Admin Page `_ (Out of date) +* `Building a new Admin Page `_ (Out of date) Plugins diff --git a/docs/upgrading/index.rst b/docs/upgrading/index.rst index be5ce29edf..12c1b3d1e0 100644 --- a/docs/upgrading/index.rst +++ b/docs/upgrading/index.rst @@ -1,7 +1,7 @@ Upgrading NodeBB ====================== -NodeBB's periodic releases are located in the `Releases `_. These releases contain what is usually considered the most bug-free code, and is designed to be used on production-level instances of NodeBB. +NodeBB's periodic releases are located in the `Releases `_. These releases contain what is usually considered the most bug-free code, and is designed to be used on production-level instances of NodeBB. You can utilise git to install a specific version of NodeBB, and upgrade periodically as new releases are made. @@ -124,7 +124,7 @@ If not upgrading between branches, just run the following command: This should retrieve the latest (and greatest) version of NodeBB from the repository. -Alternatively, download and extract the latest versioned copy of the code from `the Releases Page `_. Overwrite any files as necessary. This method is not supported. +Alternatively, download and extract the latest versioned copy of the code from `the Releases Page `_. Overwrite any files as necessary. This method is not supported. 4. Run the NodeBB upgrade script ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/widgets/create.rst b/docs/widgets/create.rst index b3f0041bc3..e3c11f1039 100644 --- a/docs/widgets/create.rst +++ b/docs/widgets/create.rst @@ -74,5 +74,5 @@ Pass this back in the array: } -And that's all. You can define as many Widget Areas in your theme as you wish. If you're still stuck, have a look at `this commit `_ which upgraded the Cerulean theme to use the widget system. +And that's all. You can define as many Widget Areas in your theme as you wish. If you're still stuck, have a look at `this commit `_ which upgraded the Cerulean theme to use the widget system. diff --git a/nodebb b/nodebb index 2d09f734db..7399f472ea 100755 --- a/nodebb +++ b/nodebb @@ -99,14 +99,14 @@ case "$1" in dev) echo "Launching NodeBB in \"development\" mode." echo "To run the production build of NodeBB, please use \"forever\"." - echo "More Information: https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB" + echo "More Information: https://github.com/NodeBB/NodeBB/wiki/How-to-run-NodeBB" NODE_ENV=development "$node" loader --no-daemon "$@" ;; watch) echo "Launching NodeBB in \"development\" mode." echo "To run the production build of NodeBB, please use \"forever\"." - echo "More Information: https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB" + echo "More Information: https://github.com/NodeBB/NodeBB/wiki/How-to-run-NodeBB" NODE_ENV=development supervisor -q --ignore public/templates --extensions 'node|js|tpl|less' -- app "$@" ;; diff --git a/package.json b/package.json index 8226b165c2..ce6195791b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "homepage": "http://www.nodebb.org", "repository": { "type": "git", - "url": "https://github.com/designcreateplay/NodeBB/" + "url": "https://github.com/NodeBB/NodeBB/" }, "main": "app.js", "scripts": { @@ -56,7 +56,7 @@ "mocha": "~1.13.0" }, "bugs": { - "url": "https://github.com/designcreateplay/NodeBB/issues" + "url": "https://github.com/NodeBB/NodeBB/issues" }, "engines": { "node": ">=0.8" diff --git a/public/src/forum/account/profile.js b/public/src/forum/account/profile.js index 9c45bf6e7b..6b6d38ad66 100644 --- a/public/src/forum/account/profile.js +++ b/public/src/forum/account/profile.js @@ -43,7 +43,7 @@ define(['forum/account/header'], function(header) { } function updateButtons() { - var isSelfOrNotLoggedIn = yourid === theirid || yourid === '0'; + var isSelfOrNotLoggedIn = yourid === theirid || parseInt(yourid, 10) === 0; $('#follow-btn').toggleClass('hide', isFollowing || isSelfOrNotLoggedIn); $('#unfollow-btn').toggleClass('hide', !isFollowing || isSelfOrNotLoggedIn); $('#chat-btn').toggleClass('hide', isSelfOrNotLoggedIn); diff --git a/public/src/modules/composer/tags.js b/public/src/modules/composer/tags.js index 4f6a6294f4..e5b1a34b83 100644 --- a/public/src/modules/composer/tags.js +++ b/public/src/modules/composer/tags.js @@ -13,7 +13,8 @@ define(function() { } tagEl.tagsinput({ - maxTags: config.tagsPerTopic + maxTags: config.tagsPerTopic, + confirmKeys: [13, 188] }); addTags(postData.tags, tagEl); diff --git a/public/src/overrides.js b/public/src/overrides.js index e77371fa71..f3b36e54d2 100644 --- a/public/src/overrides.js +++ b/public/src/overrides.js @@ -54,7 +54,7 @@ if ('undefined' !== typeof window) { })(jQuery || {fn:{}}); - // FIX FOR #1245 - https://github.com/designcreateplay/NodeBB/issues/1245 + // FIX FOR #1245 - https://github.com/NodeBB/NodeBB/issues/1245 // from http://stackoverflow.com/questions/15931962/bootstrap-dropdown-disappear-with-right-click-on-firefox // obtain a reference to the original handler var _clearMenus = $._data(document, "events").click.filter(function (el) { diff --git a/public/src/utils.js b/public/src/utils.js index 356df294c3..712171ea04 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -355,7 +355,7 @@ if(props !== undefined && !(obj[prop] instanceof Object) ) obj[prop] = {}; - return util.props(obj[prop], newProps, value); + return utils.props(obj[prop], newProps, value); } }; diff --git a/src/database/mongo/sorted.js b/src/database/mongo/sorted.js index e0c2e2cb9b..d0c6308b32 100644 --- a/src/database/mongo/sorted.js +++ b/src/database/mongo/sorted.js @@ -26,7 +26,7 @@ module.exports = function(db, module) { .sort({score: sort}) .toArray(function(err, data) { if (err || !data) { - return callback(err, null); + return callback(err); } if (!withScores) { @@ -48,7 +48,7 @@ module.exports = function(db, module) { }; module.getSortedSetRevRangeWithScores = function(key, start, stop, callback) { - getSortedSetRange(key, start, stop, -1, true, callback) + getSortedSetRange(key, start, stop, -1, true, callback); }; module.getSortedSetRangeByScore = function(key, start, count, min, max, callback) { @@ -144,4 +144,54 @@ module.exports = function(db, module) { callback(null, returnData); }); }; + + module.getSortedSetUnion = function(sets, start, stop, callback) { + getSortedSetUnion(sets, 1, start, stop, callback); + }; + + module.getSortedSetRevUnion = function(sets, start, stop, callback) { + getSortedSetUnion(sets, -1, start, stop, callback); + }; + + function getSortedSetUnion(sets, sort, start, stop, callback) { + if (typeof start === 'function') { + callback = start; + start = 0; + stop = -1; + } else if (typeof stop === 'function') { + callback = stop; + stop = -1; + } + var limit = stop - start + 1; + if (limit <= 0) { + limit = 0; + } + + var pipeline = [ + { $match: { _key: {$in: sets}} }, + { $group: { _id: {value: '$value'}, totalScore: {$sum : "$score"}} }, + { $sort: { totalScore: sort} } + ]; + + if (start) { + pipeline.push({ $skip: start }); + } + + if (limit > 0) { + pipeline.push({ $limit: limit }); + } + + pipeline.push({ $project: { _id: 0, value: '$_id.value' }}); + + db.collection('objects').aggregate(pipeline, function(err, data) { + if (err || !data) { + return callback(err); + } + + data = data.map(function(item) { + return item.value; + }); + callback(null, data); + }); + } }; \ No newline at end of file diff --git a/src/install.js b/src/install.js index f8a3182a08..ef78d10dba 100644 --- a/src/install.js +++ b/src/install.js @@ -418,7 +418,7 @@ function setCopyrightWidget(next) { db.init(function(err) { if (!err) { - db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"\",\"title\":\"\",\"container\":\"\"}}]", next); + db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"\",\"title\":\"\",\"container\":\"\"}}]", next); } }); } diff --git a/src/meta.js b/src/meta.js index a655249b1f..8df7667a21 100644 --- a/src/meta.js +++ b/src/meta.js @@ -259,7 +259,6 @@ var fs = require('fs'), jsPaths = scripts.map(function (jsPath) { jsPath = path.normalize(jsPath); - // The filter:scripts.get plugin will be deprecated as of v0.5.0, specify scripts in plugin.json instead if (jsPath.substring(0, 7) === 'plugins') { var matches = _.map(plugins.staticDirs, function(realPath, mappedPath) { if (jsPath.match(mappedPath)) { @@ -283,7 +282,6 @@ var fs = require('fs'), } }); - // Remove scripts that could not be found (remove this line at v0.5.0) Meta.js.scripts = jsPaths.filter(function(path) { return path !== null; }); diff --git a/src/middleware/index.js b/src/middleware/index.js index 197f0a9c8d..13e0df1aee 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -61,17 +61,6 @@ function routeCurrentTheme(app, themeId, themesData) { // Theme's templates path nconf.set('theme_templates_path', themeObj.templates ? path.join(themesPath, themeObj.id, themeObj.templates) : nconf.get('base_templates_path')); themeTemplatesPath = nconf.get('theme_templates_path'); - - // Theme's static directory (to be deprecated for 0.5.0) - if (themeObj.staticDir) { - app.use(relativePath + '/css/assets', express.static(path.join(themesPath, themeObj.id, themeObj.staticDir), { - maxAge: app.enabled('cache') ? 5184000000 : 0 - })); - - if (process.env.NODE_ENV === 'development') { - winston.info('Static directory routed for theme: ' + themeObj.id); - } - } } function compileTemplates(pluginTemplates) { diff --git a/src/plugins.js b/src/plugins.js index a1c715711b..61276bfffe 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -195,18 +195,8 @@ var fs = require('fs'), } Plugins.cssFiles = Plugins.cssFiles.concat(pluginData.css.map(function(file) { - if (fs.existsSync(path.join(__dirname, '../node_modules', pluginData.id, file))) { - return path.join(pluginData.id, file); - } else { - // Backwards compatibility with < v0.4.0, remove this for v0.5.0 - if (pluginData.staticDir) { - return path.join(pluginData.id, pluginData.staticDir, file); - } else { - winston.error('[plugins/' + pluginData.id + '] This plugin\'s CSS is incorrectly configured, please contact the plugin author.'); - return null; - } - } - }).filter(function(path) { return path })); // Filter out nulls, remove this for v0.5.0 + return path.join(pluginData.id, file); + })); } next(); diff --git a/src/topics/tags.js b/src/topics/tags.js index 6cee4f76b5..f113720dfa 100644 --- a/src/topics/tags.js +++ b/src/topics/tags.js @@ -9,25 +9,40 @@ var async = require('async'), module.exports = function(Topics) { Topics.createTags = function(tags, tid, timestamp, callback) { - if(Array.isArray(tags)) { - tags = tags.slice(0, meta.config.tagsPerTopic || 5); - async.each(tags, function(tag, next) { - tag = utils.removePunctuation(tag.trim().toLowerCase()).substr(0, meta.config.maximumTagLength || 15); + if (!Array.isArray(tags) || !tags.length) { + return callback(); + } - db.setAdd('topic:' + tid + ':tags', tag); + tags = tags.slice(0, meta.config.tagsPerTopic || 5); - db.sortedSetAdd('tag:' + tag + ':topics', timestamp, tid, function(err) { - if (!err) { - updateTagCount(tag); - } - next(err); - }); - }, callback); - } else { - callback(); - } + async.each(tags, function(tag, next) { + tag = cleanUpTag(tag); + + if (tag.length < (meta.config.minimumTagLength || 3)) { + return next(); + } + db.setAdd('topic:' + tid + ':tags', tag); + + db.sortedSetAdd('tag:' + tag + ':topics', timestamp, tid, function(err) { + if (!err) { + updateTagCount(tag); + } + next(err); + }); + }, callback); }; + function cleanUpTag(tag) { + tag = tag.trim().toLowerCase(); + tag = tag.replace(/[\.,\/#!$%\^&\*;:{}=_`<>'"~()?\|]/g, ''); + tag = tag.substr(0, meta.config.maximumTagLength || 15); + var matches = tag.match(/^-*(.+?)-*$/); + if (matches && matches.length > 1) { + tag = matches[1]; + } + return tag; + } + function updateTagCount(tag) { Topics.getTagTopicCount(tag, function(err, count) { if (!err) { diff --git a/src/upgrade.js b/src/upgrade.js index 35329511ce..0dcc134de5 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -521,7 +521,7 @@ Upgrade.upgrade = function(callback) { thisSchemaDate = Date.UTC(2014, 3, 31, 12, 30); if (schemaDate < thisSchemaDate) { - db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"\",\"title\":\"\",\"container\":\"\"}}]", function(err) { + db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"\",\"title\":\"\",\"container\":\"\"}}]", function(err) { if (err) { winston.error('[2014/3/31] Problem re-adding copyright message into global footer widget'); next();