mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-04 14:50:47 +01:00
closes #3130
This commit is contained in:
@@ -64,6 +64,7 @@
|
||||
"reputation": "Reputation",
|
||||
|
||||
"read_more": "read more",
|
||||
"more": "More",
|
||||
|
||||
"posted_ago_by_guest": "posted %1 by Guest",
|
||||
"posted_ago_by": "posted %1 by %2",
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
"pending.accept": "Accept",
|
||||
"pending.reject": "Reject",
|
||||
"pending.accept_all": "Accept All",
|
||||
"pending.reject_all": "Reject All",
|
||||
|
||||
"cover-instructions": "Drag and Drop a photo, drag to position, and hit <strong>Save</strong>",
|
||||
"cover-change": "Change",
|
||||
|
||||
@@ -66,6 +66,8 @@ define('forum/groups/details', ['iconSelect', 'components', 'vendor/colorpicker/
|
||||
case 'reject':
|
||||
case 'acceptInvite':
|
||||
case 'rejectInvite':
|
||||
case 'acceptAll':
|
||||
case 'rejectAll':
|
||||
socket.emit('groups.' + action, {
|
||||
toUid: uid,
|
||||
groupName: ajaxify.variables.get('group_name')
|
||||
|
||||
@@ -337,4 +337,11 @@ module.exports = function(Groups) {
|
||||
}
|
||||
db.isSetMember('group:' + groupName + ':pending', uid, callback);
|
||||
};
|
||||
|
||||
Groups.getPending = function(groupName, callback) {
|
||||
if (!groupName) {
|
||||
return callback(null, []);
|
||||
}
|
||||
db.getSetMembers('group:' + groupName + ':pending', callback);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -102,6 +102,37 @@ SocketGroups.reject = function(socket, data, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
SocketGroups.acceptAll = function(socket, data, callback) {
|
||||
acceptRejectAll('accept', socket, data, callback);
|
||||
};
|
||||
|
||||
SocketGroups.rejectAll = function(socket, data, callback) {
|
||||
acceptRejectAll('reject', socket, data, callback);
|
||||
};
|
||||
|
||||
function acceptRejectAll(type, socket, data, callback) {
|
||||
if (!data) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
groups.ownership.isOwner(socket.uid, data.groupName, function(err, isOwner) {
|
||||
if (err || !isOwner) {
|
||||
return callback(err || new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
groups.getPending(data.groupName, next);
|
||||
},
|
||||
function(uids, next) {
|
||||
var method = type === 'accept' ? groups.acceptMembership : groups.rejectMembership;
|
||||
async.each(uids, function(uid, next) {
|
||||
method(data.groupName, uid, next);
|
||||
}, next);
|
||||
}
|
||||
], callback);
|
||||
});
|
||||
}
|
||||
|
||||
SocketGroups.acceptInvite = function(socket, data, callback) {
|
||||
if (!data) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
|
||||
Reference in New Issue
Block a user