mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-16 05:20:24 +01:00
Compare commits
39 Commits
ea1309e690
...
v0.9.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fde31d5112 | ||
|
|
79107d7a26 | ||
|
|
27d3f43bf0 | ||
|
|
9666ac35a2 | ||
|
|
cf5decf5de | ||
|
|
6486197623 | ||
|
|
3a475cbbce | ||
|
|
cccc567854 | ||
|
|
a9659de87e | ||
|
|
b0e3cfcd6d | ||
|
|
34a725c9da | ||
|
|
6d859abc22 | ||
|
|
9043a40c35 | ||
|
|
711983d580 | ||
|
|
af38ec6426 | ||
|
|
6d2e91bc28 | ||
|
|
e687310cdc | ||
|
|
2c9e293680 | ||
|
|
9f14e8ee05 | ||
|
|
f0217ee198 | ||
|
|
da78e4f02b | ||
|
|
99507f6243 | ||
|
|
7d913f3420 | ||
|
|
9fb14bd510 | ||
|
|
64b044bd51 | ||
|
|
f025d7ddbf | ||
|
|
fdf9231981 | ||
|
|
d4abd87112 | ||
|
|
6d9adac6e4 | ||
|
|
f0c4052725 | ||
|
|
57b033b6d1 | ||
|
|
4d13fb6809 | ||
|
|
cee3918e9b | ||
|
|
05ef18fb2e | ||
|
|
101228711f | ||
|
|
79c0049922 | ||
|
|
7945ae071b | ||
|
|
e911256c9c | ||
|
|
15cf2f58b4 |
@@ -1,10 +1,10 @@
|
||||
# Welcome to your brand new NodeBB forum!
|
||||
|
||||
This is what a topic and post looks like. As an administator, you can edit the post\'s title and content.
|
||||
This is what a topic and post looks like. As an administrator, you can edit the post\'s title and content.
|
||||
To 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.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
* [NodeBB Documentation](https://docs.nodebb.org)
|
||||
* [Community Support Forum](https://community.nodebb.org)
|
||||
* [Project repository](https://github.com/nodebb/nodebb)
|
||||
* [Project repository](https://github.com/nodebb/nodebb)
|
||||
|
||||
4034
npm-shrinkwrap.json
generated
Normal file
4034
npm-shrinkwrap.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
"name": "nodebb",
|
||||
"license": "GPL-3.0",
|
||||
"description": "NodeBB Forum",
|
||||
"version": "0.9.3",
|
||||
"version": "0.9.4",
|
||||
"homepage": "http://www.nodebb.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -195,7 +195,14 @@ $(document).ready(function() {
|
||||
ajaxify.loadScript = function(tpl_url, callback) {
|
||||
var location = !app.inAdmin ? 'forum/' : '';
|
||||
|
||||
require([location + tpl_url], function(script) {
|
||||
var data = {
|
||||
tpl_url: tpl_url,
|
||||
scripts: [location + tpl_url]
|
||||
};
|
||||
|
||||
$(window).trigger('action:script.load', data);
|
||||
|
||||
require(data.scripts, function(script) {
|
||||
if (script && script.init) {
|
||||
script.init();
|
||||
}
|
||||
@@ -312,4 +319,4 @@ $(document).ready(function() {
|
||||
templates.cache[$(this).attr('data-template')] = $(this).html();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
/* globals config, app, ajaxify, define, socket, templates, translator, utils */
|
||||
/* globals config, app, ajaxify, define, socket, templates, utils */
|
||||
|
||||
define('forum/topic/events', [
|
||||
'forum/topic/postTools',
|
||||
'forum/topic/threadTools',
|
||||
'forum/topic/posts',
|
||||
'components'
|
||||
], function(postTools, threadTools, posts, components) {
|
||||
'components',
|
||||
'translator'
|
||||
], function(postTools, threadTools, posts, components, translator) {
|
||||
|
||||
var Events = {};
|
||||
|
||||
@@ -31,6 +32,7 @@ define('forum/topic/events', [
|
||||
|
||||
'event:post_edited': onPostEdited,
|
||||
'event:post_purged': onPostPurged,
|
||||
'event:post_moved': onPostPurged,
|
||||
|
||||
'event:post_deleted': togglePostDeleteState,
|
||||
'event:post_restored': togglePostDeleteState,
|
||||
|
||||
@@ -390,7 +390,7 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
|
||||
}
|
||||
|
||||
function movePost(post, pid, tid, callback) {
|
||||
socket.emit('posts.movePost', {pid: pid, tid: tid}, function(err) {
|
||||
socket.emit('posts.movePost', {pid: pid, tid: tid, from_tid: ajaxify.data.tid}, function(err) {
|
||||
if (err) {
|
||||
app.alertError(err.message);
|
||||
return callback();
|
||||
|
||||
@@ -32,7 +32,7 @@ module.exports = function(Categories) {
|
||||
|
||||
Categories.getRecentTopicReplies = function(categoryData, uid, callback) {
|
||||
if (!Array.isArray(categoryData) || !categoryData.length) {
|
||||
return callback(null, []);
|
||||
return callback();
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
|
||||
@@ -73,7 +73,7 @@ uploadsController.uploadThumb = function(req, res, next) {
|
||||
}
|
||||
|
||||
if (uploadedFile.type.match(/image./)) {
|
||||
var size = meta.config.topicThumbSize || 120;
|
||||
var size = parseInt(meta.config.topicThumbSize, 10) || 120;
|
||||
image.resizeImage({
|
||||
path: uploadedFile.path,
|
||||
extension: path.extname(uploadedFile.name),
|
||||
|
||||
@@ -87,4 +87,4 @@ module.exports = function(db, module) {
|
||||
module.pexpireAt = function(key, timestamp, callback) {
|
||||
module.setObjectField(key, 'expireAt', new Date(timestamp), callback);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -29,6 +29,7 @@ var async = require('async'),
|
||||
|
||||
/* Assorted */
|
||||
Meta.userOrGroupExists = function(slug, callback) {
|
||||
slug = utils.slugify(slug);
|
||||
async.parallel([
|
||||
async.apply(user.existsBySlug, slug),
|
||||
async.apply(groups.existsBySlug, slug)
|
||||
|
||||
@@ -340,11 +340,11 @@ var async = require('async'),
|
||||
'notifications:user_posted_to',
|
||||
'notifications:user_flagged_post_in'
|
||||
],
|
||||
isolated, differentiator, modifyIndex;
|
||||
isolated, differentiators, differentiator, modifyIndex, set;
|
||||
|
||||
notifications = mergeIds.reduce(function(notifications, mergeId) {
|
||||
isolated = notifications.filter(function(notifObj) {
|
||||
if (!notifObj.hasOwnProperty('mergeId')) {
|
||||
if (!notifObj || !notifObj.hasOwnProperty('mergeId')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -355,34 +355,56 @@ var async = require('async'),
|
||||
return notifications; // Nothing to merge
|
||||
}
|
||||
|
||||
differentiator = isolated[0].mergeId.split('|')[1];
|
||||
// Each isolated mergeId may have multiple differentiators, so process each separately
|
||||
differentiators = isolated.reduce(function(cur, next) {
|
||||
differentiator = next.mergeId.split('|')[1];
|
||||
if (cur.indexOf(differentiator) === -1) {
|
||||
cur.push(differentiator);
|
||||
}
|
||||
|
||||
modifyIndex = notifications.indexOf(isolated[0]);
|
||||
return cur;
|
||||
}, []);
|
||||
|
||||
differentiators.forEach(function(differentiator) {
|
||||
set = isolated.filter(function(notifObj) {
|
||||
return notifObj.mergeId === (mergeId + '|' + differentiator);
|
||||
});
|
||||
modifyIndex = notifications.indexOf(set[0]);
|
||||
if (modifyIndex === -1 || set.length === 1) {
|
||||
return notifications;
|
||||
}
|
||||
|
||||
switch(mergeId) {
|
||||
case 'notifications:favourited_your_post_in': // intentional fall-through
|
||||
case 'notifications:upvoted_your_post_in':
|
||||
case 'notifications:user_started_following_you':
|
||||
case 'notifications:user_posted_to':
|
||||
case 'notifications:user_flagged_post_in':
|
||||
var usernames = isolated.map(function(notifObj) {
|
||||
return notifObj.user.username;
|
||||
});
|
||||
var numUsers = usernames.length;
|
||||
switch(mergeId) {
|
||||
case 'notifications:favourited_your_post_in': // intentional fall-through
|
||||
case 'notifications:upvoted_your_post_in':
|
||||
case 'notifications:user_started_following_you':
|
||||
case 'notifications:user_posted_to':
|
||||
case 'notifications:user_flagged_post_in':
|
||||
var usernames = set.map(function(notifObj) {
|
||||
return notifObj.user.username;
|
||||
});
|
||||
var numUsers = usernames.length;
|
||||
|
||||
// Update bodyShort
|
||||
if (numUsers === 2) {
|
||||
isolated[0].bodyShort = '[[' + mergeId + '_dual, ' + usernames.join(', ') + ', ' + isolated[0].topicTitle + ']]'
|
||||
} else {
|
||||
isolated[0].bodyShort = '[[' + mergeId + '_multiple, ' + usernames[0] + ', ' + (numUsers-1) + ', ' + isolated[0].topicTitle + ']]'
|
||||
// Update bodyShort
|
||||
if (numUsers === 2) {
|
||||
notifications[modifyIndex].bodyShort = '[[' + mergeId + '_dual, ' + usernames.join(', ') + ', ' + notifications[modifyIndex].topicTitle + ']]'
|
||||
} else {
|
||||
notifications[modifyIndex].bodyShort = '[[' + mergeId + '_multiple, ' + usernames[0] + ', ' + (numUsers-1) + ', ' + notifications[modifyIndex].topicTitle + ']]'
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Filter out duplicates
|
||||
notifications = notifications.filter(function(notifObj, idx) {
|
||||
if (!notifObj || !notifObj.mergeId) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Filter out duplicates
|
||||
return notifications.filter(function(notifObj, idx) {
|
||||
return notifObj.mergeId !== mergeId + '|' + differentiator || idx === modifyIndex;
|
||||
return !(notifObj.mergeId === (mergeId + '|' + differentiator) && idx !== modifyIndex);
|
||||
});
|
||||
});
|
||||
|
||||
return notifications;
|
||||
}, notifications);
|
||||
|
||||
plugins.fireHook('filter:notifications.merge', {
|
||||
|
||||
@@ -270,7 +270,7 @@ function getHourlyStatsForSet(set, hour, numHours, callback) {
|
||||
}
|
||||
|
||||
hoursArr.forEach(function(term, index) {
|
||||
terms[term] = counts[index] || 0;
|
||||
terms[term] = parseInt(counts[index], 10) || 0;
|
||||
});
|
||||
|
||||
var termsArr = [];
|
||||
|
||||
@@ -22,6 +22,10 @@ SocketGroups.join = function(socket, data, callback) {
|
||||
return callback(new Error('[[error:invalid-uid]]'));
|
||||
}
|
||||
|
||||
if (data.groupName === 'administrators' || groups.isPrivilegeGroup(data.groupName)) {
|
||||
return callback(new Error('[[error:not-allowed]]'));
|
||||
}
|
||||
|
||||
groups.exists(data.groupName, function(err, exists) {
|
||||
if (err || !exists) {
|
||||
return callback(err || new Error('[[error:no-group]]'));
|
||||
@@ -39,10 +43,10 @@ SocketGroups.join = function(socket, data, callback) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (checks.isPrivate && !checks.isAdmin) {
|
||||
groups.requestMembership(data.groupName, socket.uid, callback);
|
||||
} else {
|
||||
if (!checks.isPrivate || checks.isAdmin) {
|
||||
groups.join(data.groupName, socket.uid, callback);
|
||||
} else {
|
||||
groups.requestMembership(data.groupName, socket.uid, callback);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ var async = require('async');
|
||||
var privileges = require('../../privileges');
|
||||
var topics = require('../../topics');
|
||||
var socketHelpers = require('../helpers');
|
||||
var websockets = require('../index');
|
||||
|
||||
module.exports = function(SocketPosts) {
|
||||
|
||||
@@ -12,7 +13,7 @@ module.exports = function(SocketPosts) {
|
||||
return callback(new Error('[[error:not-logged-in]]'));
|
||||
}
|
||||
|
||||
if (!data || !data.pid || !data.tid) {
|
||||
if (!data || !data.pid || !data.tid || !data.from_tid) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
@@ -29,6 +30,8 @@ module.exports = function(SocketPosts) {
|
||||
},
|
||||
function (next) {
|
||||
socketHelpers.sendNotificationToPostOwner(data.pid, socket.uid, 'notifications:moved_your_post');
|
||||
websockets.in('topic_' + data.from_tid).emit('event:post_moved', data.pid);
|
||||
|
||||
next();
|
||||
}
|
||||
], callback);
|
||||
|
||||
@@ -71,4 +71,4 @@ module.exports = function(SocketTopics) {
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -42,9 +42,9 @@ module.exports = function(SocketUser) {
|
||||
return callback(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
|
||||
user.isAdministrator(socket.uid, function(err, isAdmin) {
|
||||
if (!isAdmin && data.uid !== socket.uid) {
|
||||
return callback(new Error('[[error:no-privileges]]'));
|
||||
user.isAdminOrSelf(socket.uid, data.uid, function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
user.removeCoverPicture(data, callback);
|
||||
@@ -154,4 +154,4 @@ module.exports = function(SocketUser) {
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@@ -330,7 +330,7 @@ module.exports = function(Topics) {
|
||||
var maximumTopics = parseInt(meta.config.maximumRelatedTopics, 10) || 5;
|
||||
|
||||
if (!topicData.tags.length || maximumTopics === 0) {
|
||||
return callback(null, topicData);
|
||||
return callback(null, []);
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
@@ -351,4 +351,4 @@ module.exports = function(Topics) {
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user