feat(invitations): oper/admin can delete All Expired Official Invitation

#20
This commit is contained in:
OldHawk
2017-12-05 15:47:17 +08:00
parent 5ed926e27f
commit 23852f7740
10 changed files with 85 additions and 14 deletions

View File

@@ -6,10 +6,10 @@
.controller('AdminInvitationController', AdminInvitationController);
AdminInvitationController.$inject = ['$scope', '$state', 'Authentication', 'InvitationsService', 'NotifycationService', 'DebugConsoleService', '$translate',
'MeanTorrentConfig', '$filter', '$timeout'];
'MeanTorrentConfig', '$filter', '$timeout', 'ModalConfirmService'];
function AdminInvitationController($scope, $state, Authentication, InvitationsService, NotifycationService, mtDebug, $translate,
MeanTorrentConfig, $filter, $timeout) {
MeanTorrentConfig, $filter, $timeout, ModalConfirmService) {
var vm = this;
vm.user = Authentication.user;
vm.announce = MeanTorrentConfig.meanTorrentConfig.announce;
@@ -106,5 +106,29 @@
}
}
};
/**
* deleteExpiredOfficialInvitation
*/
vm.deleteExpiredOfficialInvitation = function () {
var modalOptions = {
closeButtonText: $translate.instant('DELETE_EXPIRED_CONFIRM_CANCEL'),
actionButtonText: $translate.instant('DELETE_EXPIRED_CONFIRM_OK'),
headerText: $translate.instant('DELETE_EXPIRED_CONFIRM_HEADER_TEXT'),
bodyText: $translate.instant('DELETE_EXPIRED_CONFIRM_BODY_TEXT')
};
ModalConfirmService.showModal({}, modalOptions)
.then(function (result) {
InvitationsService.deleteExpiredOfficialInvitation(function (response) {
NotifycationService.showSuccessNotify('DELETE_EXPIRED_SUCCESSFULLY');
$timeout(function () {
$state.reload();
}, 100);
}, function (response) {
NotifycationService.showErrorNotify(response.data.message, 'DELETE_EXPIRED_ERROR');
});
});
};
}
}());