Merge branch 'master' into 0.7.0

v1.18.x
Julian Lam 10 years ago
commit 4c927060d9

@ -254,7 +254,9 @@ app.uid = null;
app.replaceSelfLinks();
setTimeout(function () {
window.scrollTo(0, 1); // rehide address bar on mobile after page load completes.
if (window.scrollY === 0) {
window.scrollTo(0, 1); // rehide address bar on mobile after page load completes.
}
}, 100);
};

@ -631,10 +631,23 @@ var async = require('async'),
Groups.exists(groupName, function(err, exists) {
if (exists) {
db.sortedSetAdd('group:' + groupName + ':members', Date.now(), uid, callback);
plugins.fireHook('action:group.join', {
groupName: groupName,
uid: uid
var tasks = [
async.apply(db.sortedSetAdd, 'group:' + groupName + ':members', Date.now(), uid)
];
user.isAdministrator(uid, function(err, isAdmin) {
if (isAdmin) {
tasks.push(async.apply(db.setAdd, 'group:' + groupName + ':owners', uid));
}
async.parallel(tasks, function(err) {
plugins.fireHook('action:group.join', {
groupName: groupName,
uid: uid
});
callback();
});
});
} else {
Groups.create({

@ -2,6 +2,9 @@
var groups = require('../groups'),
meta = require('../meta'),
user = require('../user'),
async = require('async'),
SocketGroups = {};
@ -11,8 +14,11 @@ SocketGroups.join = function(socket, data, callback) {
}
if (meta.config.allowPrivateGroups !== '0') {
groups.isPrivate(data.groupName, function(err, isPrivate) {
if (isPrivate) {
async.parallel({
isAdmin: async.apply(user.isAdministrator, socket.uid),
isPrivate: async.apply(groups.isPrivate, data.groupName)
}, function(err, checks) {
if (checks.isPrivate && !checks.isAdmin) {
groups.requestMembership(data.groupName, socket.uid, callback);
} else {
groups.join(data.groupName, socket.uid, callback);

Loading…
Cancel
Save