mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-29 02:39:55 +01:00
Merge remote-tracking branch 'origin/master' into 0.7.0
This commit is contained in:
@@ -65,6 +65,7 @@
|
||||
"group-name-too-short": "Group name too short",
|
||||
"group-already-exists": "Group already exists",
|
||||
"group-name-change-not-allowed": "Group name change not allowed",
|
||||
"group-already-member": "You are already part of this group",
|
||||
|
||||
"post-already-deleted": "This post has already been deleted",
|
||||
"post-already-restored": "This post has already been restored",
|
||||
|
||||
@@ -120,7 +120,9 @@ define('forum/groups/details', ['iconSelect', 'vendor/colorpicker/colorpicker',
|
||||
}
|
||||
|
||||
if (settings.name) {
|
||||
ajaxify.go('groups/' + encodeURIComponent(settings.name));
|
||||
var pathname = window.location.pathname;
|
||||
pathname = pathname.substr(1, pathname.lastIndexOf('/'));
|
||||
ajaxify.go(pathname + encodeURIComponent(settings.name));
|
||||
} else {
|
||||
ajaxify.refresh();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ define('forum/groups/list', function() {
|
||||
groupsEl.on('click', '.list-cover', function() {
|
||||
var groupName = $(this).parents('[data-group]').attr('data-group');
|
||||
|
||||
ajaxify.go('groups/' + groupName);
|
||||
ajaxify.go('groups/' + encodeURIComponent(groupName));
|
||||
});
|
||||
|
||||
// Group creation
|
||||
|
||||
@@ -77,6 +77,7 @@ module.exports = function(redisClient, module) {
|
||||
};
|
||||
|
||||
module.deleteAll = function(keys, callback) {
|
||||
callback = callback || function() {};
|
||||
var multi = redisClient.multi();
|
||||
for(var i=0; i<keys.length; ++i) {
|
||||
multi.del(keys[i]);
|
||||
@@ -91,16 +92,19 @@ module.exports = function(redisClient, module) {
|
||||
};
|
||||
|
||||
module.set = function(key, value, callback) {
|
||||
callback = callback || function() {};
|
||||
redisClient.set(key, value, function(err) {
|
||||
callback(err);
|
||||
});
|
||||
};
|
||||
|
||||
module.increment = function(key, callback) {
|
||||
callback = callback || function() {};
|
||||
redisClient.incr(key, callback);
|
||||
};
|
||||
|
||||
module.rename = function(oldKey, newKey, callback) {
|
||||
callback = callback || function() {};
|
||||
redisClient.rename(oldKey, newKey, function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
|
||||
@@ -7,6 +7,7 @@ var async = require('async'),
|
||||
path = require('path'),
|
||||
nconf = require('nconf'),
|
||||
fs = require('fs'),
|
||||
validator = require('validator'),
|
||||
|
||||
user = require('./user'),
|
||||
meta = require('./meta'),
|
||||
@@ -202,6 +203,9 @@ var async = require('async'),
|
||||
results.base['cover:position'] = '50% 50%';
|
||||
}
|
||||
|
||||
results.base.name = validator.escape(results.base.name);
|
||||
results.base.description = validator.escape(results.base.description);
|
||||
results.base.userTitle = validator.escape(results.base.userTitle);
|
||||
results.base.members = results.users.filter(Boolean);
|
||||
results.base.pending = results.pending.filter(Boolean);
|
||||
results.base.count = numUsers || results.base.members.length;
|
||||
@@ -611,15 +615,26 @@ var async = require('async'),
|
||||
};
|
||||
|
||||
Groups.requestMembership = function(groupName, uid, callback) {
|
||||
if (parseInt(uid, 10) > 0) {
|
||||
db.setAdd('group:' + groupName + ':pending', uid, callback);
|
||||
plugins.fireHook('action:group.requestMembership', {
|
||||
groupName: groupName,
|
||||
uid: uid
|
||||
});
|
||||
} else {
|
||||
callback(new Error('[[error:not-logged-in]]'));
|
||||
}
|
||||
async.parallel({
|
||||
exists: async.apply(Groups.isMember, uid, groupName),
|
||||
isMember: async.apply(Groups.exists, groupName)
|
||||
}, function(err, checks) {
|
||||
if (!checks.exists) {
|
||||
return callback(new Error('[[error:no-group]]'));
|
||||
} else if (checks.isMember) {
|
||||
return callback(new Error('[[error:group-already-member]]'));
|
||||
}
|
||||
|
||||
if (parseInt(uid, 10) > 0) {
|
||||
db.setAdd('group:' + groupName + ':pending', uid, callback);
|
||||
plugins.fireHook('action:group.requestMembership', {
|
||||
groupName: groupName,
|
||||
uid: uid
|
||||
});
|
||||
} else {
|
||||
callback(new Error('[[error:not-logged-in]]'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Groups.acceptMembership = function(groupName, uid, callback) {
|
||||
|
||||
@@ -143,6 +143,12 @@ module.exports = function(privileges) {
|
||||
}, callback);
|
||||
};
|
||||
|
||||
privileges.categories.rescind = function(privileges, cid, groupName, callback) {
|
||||
async.each(privileges, function(privilege, next) {
|
||||
groups.leave('cid:' + cid + ':privileges:groups:' + privilege, groupName, next);
|
||||
}, callback);
|
||||
};
|
||||
|
||||
privileges.categories.canMoveAllTopics = function(currentCid, targetCid, uid, callback) {
|
||||
async.parallel({
|
||||
isAdministrator: function(next) {
|
||||
|
||||
Reference in New Issue
Block a user