1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-09-19 15:11:40 +02:00

Merge pull request #384 from tdtgit/delete-link-confirm

Users should be warned before they delete users or links
This commit is contained in:
Evan McMahon 2018-03-29 18:30:55 +11:00 committed by GitHub
commit d39efe6aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -264,14 +264,16 @@ polr.controller('AdminCtrl', function($scope, $compile, $timeout) {
// Delete user // Delete user
$scope.deleteUser = function($event, user_id) { $scope.deleteUser = function($event, user_id) {
var el = $($event.target); if(confirm("Are you sure to delete this user?")){
var el = $($event.target);
apiCall('admin/delete_user', {
'user_id': user_id, apiCall('admin/delete_user', {
}, function(new_status) { 'user_id': user_id,
toastr.success('User successfully deleted.', 'Success'); }, function(new_status) {
$scope.reloadUserTables(); toastr.success('User successfully deleted.', 'Success');
}); $scope.reloadUserTables();
});
}
}; };
$scope.changeUserRole = function(role, user_id) { $scope.changeUserRole = function(role, user_id) {
@ -305,14 +307,16 @@ polr.controller('AdminCtrl', function($scope, $compile, $timeout) {
// Delete link // Delete link
$scope.deleteLink = function($event, link_ending) { $scope.deleteLink = function($event, link_ending) {
var el = $($event.target); if(confirm("Are you sure to delete this link?")){
var el = $($event.target);
apiCall('admin/delete_link', { apiCall('admin/delete_link', {
'link_ending': link_ending, 'link_ending': link_ending,
}, function(new_status) { }, function(new_status) {
toastr.success('Link successfully deleted.', 'Success'); toastr.success('Link successfully deleted.', 'Success');
$scope.reloadLinkTables(); $scope.reloadLinkTables();
}); });
}
}; };
// Disable and enable links // Disable and enable links