Confirm before removing user and group cover picture

v1.18.x
pichalite 8 years ago
parent 277f447f3e
commit 5b646495af

@ -61,5 +61,6 @@
"new-group.group_name": "Group Name:", "new-group.group_name": "Group Name:",
"upload-group-cover": "Upload group cover", "upload-group-cover": "Upload group cover",
"bulk-invite-instructions": "Enter a list of comma separated usernames to invite to this group", "bulk-invite-instructions": "Enter a list of comma separated usernames to invite to this group",
"bulk-invite": "Bulk Invite" "bulk-invite": "Bulk Invite",
"remove_group_cover_confirm": "Are you sure you want to remove the cover picture?"
} }

@ -67,6 +67,7 @@
"upload_a_picture": "Upload a picture", "upload_a_picture": "Upload a picture",
"remove_uploaded_picture" : "Remove Uploaded Picture", "remove_uploaded_picture" : "Remove Uploaded Picture",
"upload_cover_picture": "Upload cover picture", "upload_cover_picture": "Upload cover picture",
"remove_cover_picture_confirm": "Are you sure you want to remove the cover picture?",
"settings": "Settings", "settings": "Settings",
"show_email": "Show My Email", "show_email": "Show My Email",

@ -168,14 +168,22 @@ define('forum/account/header', [
} }
function removeCover() { function removeCover() {
socket.emit('user.removeCover', { translator.translate('[[user:remove_cover_picture_confirm]]', function (translated) {
uid: ajaxify.data.uid bootbox.confirm(translated, function (confirm) {
}, function (err) { if (!confirm) {
if (!err) { return;
ajaxify.refresh(); }
} else {
app.alertError(err.message); socket.emit('user.removeCover', {
} uid: ajaxify.data.uid
}, function (err) {
if (!err) {
ajaxify.refresh();
} else {
app.alertError(err.message);
}
});
});
}); });
} }

@ -7,8 +7,9 @@ define('forum/groups/details', [
'components', 'components',
'coverPhoto', 'coverPhoto',
'uploader', 'uploader',
'translator',
'vendor/colorpicker/colorpicker' 'vendor/colorpicker/colorpicker'
], function (memberList, iconSelect, components, coverPhoto, uploader) { ], function (memberList, iconSelect, components, coverPhoto, uploader, translator) {
var Details = {}; var Details = {};
var groupName; var groupName;
@ -265,14 +266,22 @@ define('forum/groups/details', [
} }
function removeCover() { function removeCover() {
socket.emit('groups.cover.remove', { translator.translate('[[groups:remove_group_cover_confirm]]', function (translated) {
groupName: ajaxify.data.group.name bootbox.confirm(translated, function (confirm) {
}, function (err) { if (!confirm) {
if (!err) { return;
ajaxify.refresh(); }
} else {
app.alertError(err.message); socket.emit('groups.cover.remove', {
} groupName: ajaxify.data.group.name
}, function (err) {
if (!err) {
ajaxify.refresh();
} else {
app.alertError(err.message);
}
});
});
}); });
} }

Loading…
Cancel
Save