mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-11-03 20:45:58 +01:00 
			
		
		
		
	Merge branch 'master' into develop
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
var async = require('async');
 | 
			
		||||
var validator = require('validator');
 | 
			
		||||
@@ -13,7 +13,7 @@ var plugins = require('../../plugins');
 | 
			
		||||
var User = {};
 | 
			
		||||
 | 
			
		||||
User.makeAdmins = function (socket, uids, callback) {
 | 
			
		||||
	if(!Array.isArray(uids)) {
 | 
			
		||||
	if (!Array.isArray(uids)) {
 | 
			
		||||
		return callback(new Error('[[error:invalid-data]]'));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -22,7 +22,7 @@ User.makeAdmins = function (socket, uids, callback) {
 | 
			
		||||
			return callback(err);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		for(var i = 0; i < userData.length; i++) {
 | 
			
		||||
		for (var i = 0; i < userData.length; i += 1) {
 | 
			
		||||
			if (userData[i] && parseInt(userData[i].banned, 10) === 1) {
 | 
			
		||||
				return callback(new Error('[[error:cant-make-banned-users-admin]]'));
 | 
			
		||||
			}
 | 
			
		||||
@@ -35,7 +35,7 @@ User.makeAdmins = function (socket, uids, callback) {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
User.removeAdmins = function (socket, uids, callback) {
 | 
			
		||||
	if(!Array.isArray(uids)) {
 | 
			
		||||
	if (!Array.isArray(uids)) {
 | 
			
		||||
		return callback(new Error('[[error:invalid-data]]'));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -109,7 +109,7 @@ User.sendValidationEmail = function (socket, uids, callback) {
 | 
			
		||||
					next();
 | 
			
		||||
				}
 | 
			
		||||
			}, next);
 | 
			
		||||
		}
 | 
			
		||||
		},
 | 
			
		||||
	], callback);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -169,17 +169,17 @@ function deleteUsers(socket, uids, method, callback) {
 | 
			
		||||
					type: 'user-delete',
 | 
			
		||||
					uid: socket.uid,
 | 
			
		||||
					targetUid: uid,
 | 
			
		||||
					ip: socket.ip
 | 
			
		||||
					ip: socket.ip,
 | 
			
		||||
				}, next);
 | 
			
		||||
			},
 | 
			
		||||
			function (next) {
 | 
			
		||||
				plugins.fireHook('action:user.delete', {
 | 
			
		||||
					callerUid: socket.uid,
 | 
			
		||||
					uid: uid,
 | 
			
		||||
					ip: socket.ip
 | 
			
		||||
					ip: socket.ip,
 | 
			
		||||
				});
 | 
			
		||||
				next();
 | 
			
		||||
			}
 | 
			
		||||
			},
 | 
			
		||||
		], next);
 | 
			
		||||
	}, callback);
 | 
			
		||||
}
 | 
			
		||||
@@ -188,7 +188,7 @@ User.search = function (socket, data, callback) {
 | 
			
		||||
	var searchData;
 | 
			
		||||
	async.waterfall([
 | 
			
		||||
		function (next) {
 | 
			
		||||
			user.search({query: data.query, searchBy: data.searchBy, uid: socket.uid}, next);
 | 
			
		||||
			user.search({ query: data.query, searchBy: data.searchBy, uid: socket.uid }, next);
 | 
			
		||||
		},
 | 
			
		||||
		function (_searchData, next) {
 | 
			
		||||
			searchData = _searchData;
 | 
			
		||||
@@ -212,7 +212,7 @@ User.search = function (socket, data, callback) {
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
			next(null, searchData);
 | 
			
		||||
		}
 | 
			
		||||
		},
 | 
			
		||||
	], callback);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -230,10 +230,10 @@ User.acceptRegistration = function (socket, data, callback) {
 | 
			
		||||
				type: 'registration-approved',
 | 
			
		||||
				uid: socket.uid,
 | 
			
		||||
				ip: socket.ip,
 | 
			
		||||
				targetUid: uid
 | 
			
		||||
				targetUid: uid,
 | 
			
		||||
			});
 | 
			
		||||
			next(null, uid);
 | 
			
		||||
		}
 | 
			
		||||
		},
 | 
			
		||||
	], callback);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -250,7 +250,7 @@ User.rejectRegistration = function (socket, data, callback) {
 | 
			
		||||
				username: data.username,
 | 
			
		||||
			});
 | 
			
		||||
			next();
 | 
			
		||||
		}
 | 
			
		||||
		},
 | 
			
		||||
	], callback);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user