mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-07 11:21:51 +02:00
Merge remote-tracking branch 'origin/master' into groups-pages
Conflicts: src/topics/tags.js
This commit is contained in:
10
README.md
10
README.md
@@ -1,6 +1,6 @@
|
||||
# <img alt="NodeBB" src="http://i.imgur.com/3yj1n6N.png" />
|
||||
[](https://travis-ci.org/designcreateplay/NodeBB)
|
||||
[](https://david-dm.org/designcreateplay/nodebb)
|
||||
# <img alt="NodeBB" src="http://i.imgur.com/mYxPPtB.png" />
|
||||
[](https://travis-ci.org/nodebb/nodebb)
|
||||
[](https://david-dm.org/nodebb/nodebb)
|
||||
[](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)
|
||||
|
||||
2
app.js
2
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)');
|
||||
}
|
||||
|
||||
@@ -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
|
||||
-------------------------
|
||||
|
||||
@@ -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 <https://github.com/designcreateplay/NodeBB/issues?state=closed>`_, or has already been resolved on our `support forum <http://community.nodebb.org/category/6/bug-reports>`_. If it has not been filed, feel free to create an account on GitHub and `create a new issue <https://github.com/designcreateplay/NodeBB/issues>`_.
|
||||
Before reporting bugs, please ensure that the issue has not already been filed on our `tracker <https://github.com/NodeBB/NodeBB/issues?state=closed>`_, or has already been resolved on our `support forum <http://community.nodebb.org/category/6/bug-reports>`_. If it has not been filed, feel free to create an account on GitHub and `create a new issue <https://github.com/NodeBB/NodeBB/issues>`_.
|
||||
|
||||
|
||||
Ask the NodeBB Community
|
||||
|
||||
@@ -7,7 +7,7 @@ NodeBB is an open source project, and will forever remain free. Here's a number
|
||||
* `Follow us on Twitter <http://www.twitter.com/NodeBB>`_ 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.. <http://www.github.com/designcreateplay/NodeBB>`_
|
||||
* `Submit a pull request, or two, or three.. <http://www.github.com/NodeBB/NodeBB>`_
|
||||
* 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 <http://sphinx-doc.org/>`_ and published using `rtfd.org <http://readthedocs.org/>`_.
|
||||
|
||||
You can edit these docs `directly on GitHub <https://github.com/designcreateplay/NodeBB/tree/master/docs>`_, or by clicking on "View page source" on the top right of any page.
|
||||
You can edit these docs `directly on GitHub <https://github.com/NodeBB/NodeBB/tree/master/docs>`_, 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 <https://read-the-docs.readthedocs.org/en/latest/getting_started.html>`_ section for more info on how to accomplish the latter.
|
||||
|
||||
|
||||
@@ -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 <https://github.com/designcreateplay/NodeBB/>`_. 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 <https://github.com/NodeBB/NodeBB/>`_. 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
|
||||
=================
|
||||
|
||||
@@ -7,7 +7,7 @@ The following are installation instructions for the `Cloud 9 <https://c9.io/>`_
|
||||
|
||||
.. 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.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Heroku
|
||||
1. Download and install `Heroku Toolbelt <https://toolbelt.heroku.com/>`_ 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 <https://github.com/designcreateplay/NodeBB/issues>`_.
|
||||
If these instructions are unclear or if you run into trouble, please let us know by `filing an issue <https://github.com/NodeBB/NodeBB/issues>`_.
|
||||
|
||||
Keeping it up to date
|
||||
---------------------
|
||||
|
||||
@@ -7,7 +7,7 @@ The following are installation instructions for the `Cloud 9 <https://c9.io/>`_
|
||||
|
||||
.. 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.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Heroku
|
||||
1. Download and install `Heroku Toolbelt <https://toolbelt.heroku.com/>`_ 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 <https://github.com/designcreateplay/NodeBB/issues>`_.
|
||||
If these instructions are unclear or if you run into trouble, please let us know by `filing an issue <https://github.com/NodeBB/NodeBB/issues>`_.
|
||||
|
||||
Keeping it up to date
|
||||
---------------------
|
||||
|
||||
@@ -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 <https://github.com/designcreateplay/NodeBB#securing-nodebb>`_.
|
||||
You should secure your NodeBB installation, `take a look here <https://github.com/NodeBB/NodeBB#securing-nodebb>`_.
|
||||
|
||||
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>`
|
||||
@@ -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 <https://github.com/designcreateplay/NodeBB/issues>`_.
|
||||
**Note:** If these instructions are unclear or if you run into trouble, please let us know by `filing an issue <https://github.com/NodeBB/NodeBB/issues>`_.
|
||||
|
||||
Upgrading NodeBB
|
||||
----------------
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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 <https://github.com/designcreateplay/NodeBB/issues>`_ 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 <https://github.com/NodeBB/NodeBB/issues>`_ and we'll include it in the next version of NodeBB.
|
||||
|
||||
Configuration
|
||||
------------------
|
||||
|
||||
@@ -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 <https://github.com/designcreateplay/NodeBB/issues>`_.
|
||||
**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 <https://github.com/NodeBB/NodeBB/issues>`_.
|
||||
|
||||
|
||||
Filters
|
||||
|
||||
@@ -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 <https://github.com/designcreateplay/NodeBB/tree/master/public/src/modules/settings>`_.
|
||||
`default plugins <https://github.com/NodeBB/NodeBB/tree/master/public/src/modules/settings>`_.
|
||||
|
||||
You should also take a look at the helper-functions within
|
||||
`Settings <https://github.com/designcreateplay/NodeBB/tree/master/public/src/modules/settings.js>`_ in order to create
|
||||
`Settings <https://github.com/NodeBB/NodeBB/tree/master/public/src/modules/settings.js>`_ in order to create
|
||||
your own plugins. There are a few methods that take response to call the methods of other plugins when fittingly.
|
||||
|
||||
@@ -10,7 +10,7 @@ Developer's Resources
|
||||
Core
|
||||
----
|
||||
|
||||
* `Building a new Admin Page <https://github.com/designcreateplay/NodeBB/wiki/How-to-build-a-new-Admin-Page>`_ (Out of date)
|
||||
* `Building a new Admin Page <https://github.com/NodeBB/NodeBB/wiki/How-to-build-a-new-Admin-Page>`_ (Out of date)
|
||||
|
||||
|
||||
Plugins
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Upgrading NodeBB
|
||||
======================
|
||||
|
||||
NodeBB's periodic releases are located in the `Releases <https://github.com/designcreateplay/NodeBB/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 <https://github.com/NodeBB/NodeBB/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 <https://github.com/designcreateplay/NodeBB/releases>`_. 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 <https://github.com/NodeBB/NodeBB/releases>`_. Overwrite any files as necessary. This method is not supported.
|
||||
|
||||
4. Run the NodeBB upgrade script
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -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 <https://github.com/designcreateplay/nodebb-theme-cerulean/commit/50e49a9da5a89484fa8001bbda2e613b69f18e86>`_ 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 <https://github.com/NodeBB/nodebb-theme-cerulean/commit/50e49a9da5a89484fa8001bbda2e613b69f18e86>`_ which upgraded the Cerulean theme to use the widget system.
|
||||
|
||||
|
||||
4
nodebb
4
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 "$@"
|
||||
;;
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -13,7 +13,8 @@ define(function() {
|
||||
}
|
||||
|
||||
tagEl.tagsinput({
|
||||
maxTags: config.tagsPerTopic
|
||||
maxTags: config.tagsPerTopic,
|
||||
confirmKeys: [13, 188]
|
||||
});
|
||||
addTags(postData.tags, tagEl);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -418,7 +418,7 @@ function setCopyrightWidget(next) {
|
||||
|
||||
db.init(function(err) {
|
||||
if (!err) {
|
||||
db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"<footer id=\\\"footer\\\" class=\\\"container footer\\\">\\r\\n\\t<div class=\\\"copyright\\\">\\r\\n\\t\\tCopyright © 2014 <a target=\\\"_blank\\\" href=\\\"https://www.nodebb.com\\\">NodeBB Forums</a> | <a target=\\\"_blank\\\" href=\\\"//github.com/designcreateplay/NodeBB/graphs/contributors\\\">Contributors</a>\\r\\n\\t</div>\\r\\n</footer>\",\"title\":\"\",\"container\":\"\"}}]", next);
|
||||
db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"<footer id=\\\"footer\\\" class=\\\"container footer\\\">\\r\\n\\t<div class=\\\"copyright\\\">\\r\\n\\t\\tCopyright © 2014 <a target=\\\"_blank\\\" href=\\\"https://www.nodebb.com\\\">NodeBB Forums</a> | <a target=\\\"_blank\\\" href=\\\"//github.com/NodeBB/NodeBB/graphs/contributors\\\">Contributors</a>\\r\\n\\t</div>\\r\\n</footer>\",\"title\":\"\",\"container\":\"\"}}]", next);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
db.setAdd('topic:' + tid + ':tags', tag);
|
||||
|
||||
db.sortedSetAdd('tag:' + tag + ':topics', timestamp, tid, function(err) {
|
||||
if (!err) {
|
||||
updateTagCount(tag);
|
||||
}
|
||||
next(err);
|
||||
});
|
||||
}, callback);
|
||||
} else {
|
||||
callback();
|
||||
if (!Array.isArray(tags) || !tags.length) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
tags = tags.slice(0, meta.config.tagsPerTopic || 5);
|
||||
|
||||
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) {
|
||||
|
||||
@@ -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\":\"<footer id=\\\"footer\\\" class=\\\"container footer\\\">\\r\\n\\t<div class=\\\"copyright\\\">\\r\\n\\t\\tCopyright © 2014 <a target=\\\"_blank\\\" href=\\\"https://www.nodebb.com\\\">NodeBB Forums</a> | <a target=\\\"_blank\\\" href=\\\"//github.com/designcreateplay/NodeBB/graphs/contributors\\\">Contributors</a>\\r\\n\\t</div>\\r\\n</footer>\",\"title\":\"\",\"container\":\"\"}}]", function(err) {
|
||||
db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"<footer id=\\\"footer\\\" class=\\\"container footer\\\">\\r\\n\\t<div class=\\\"copyright\\\">\\r\\n\\t\\tCopyright © 2014 <a target=\\\"_blank\\\" href=\\\"https://www.nodebb.com\\\">NodeBB Forums</a> | <a target=\\\"_blank\\\" href=\\\"//github.com/NodeBB/NodeBB/graphs/contributors\\\">Contributors</a>\\r\\n\\t</div>\\r\\n</footer>\",\"title\":\"\",\"container\":\"\"}}]", function(err) {
|
||||
if (err) {
|
||||
winston.error('[2014/3/31] Problem re-adding copyright message into global footer widget');
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user