mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-10 06:30:47 +01:00
Cover photo removal for groups, #3832
This commit is contained in:
@@ -181,6 +181,10 @@ module.exports = function(Groups) {
|
||||
});
|
||||
};
|
||||
|
||||
Groups.removeCover = function(data, callback) {
|
||||
db.deleteObjectField('group:' + data.groupName, 'cover:url', callback);
|
||||
};
|
||||
|
||||
function updatePrivacy(groupName, newValue, callback) {
|
||||
if (!newValue) {
|
||||
return callback();
|
||||
|
||||
@@ -242,4 +242,18 @@ SocketGroups.cover.update = function(socket, data, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
SocketGroups.cover.remove = function(socket, data, callback) {
|
||||
if (!socket.uid) {
|
||||
return callback(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
|
||||
groups.ownership.isOwner(socket.uid, data.groupName, function(err, isOwner) {
|
||||
if (!isOwner) {
|
||||
return callback(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
|
||||
groups.removeCover(data, callback);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = SocketGroups;
|
||||
|
||||
Reference in New Issue
Block a user