mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Add method to remove blank uuids
This commit is contained in:
@@ -28,7 +28,7 @@ habitrpg.controller('InviteToGroupCtrl', ['$scope', 'User', 'Groups', 'injectedG
|
||||
});
|
||||
}
|
||||
else if (inviteMethod === 'uuid') {
|
||||
var uuids = _.pluck($scope.invitees, 'uuid');
|
||||
var uuids = _getOnlyUuids();
|
||||
Groups.Group.invite({gid: $scope.group._id}, {uuids: uuids}, function(){
|
||||
Notification.text(window.env.t('invitationsSent'));
|
||||
_resetInvitees();
|
||||
@@ -41,6 +41,14 @@ habitrpg.controller('InviteToGroupCtrl', ['$scope', 'User', 'Groups', 'injectedG
|
||||
}
|
||||
}
|
||||
|
||||
function _getOnlyUuids() {
|
||||
var uuids = _.pluck($scope.invitees, 'uuid');
|
||||
var filteredUuids = _.filter(uuids, function(id) {
|
||||
return id != '';
|
||||
});
|
||||
return filteredUuids;
|
||||
}
|
||||
|
||||
function _resetInvitees() {
|
||||
var emptyEmails = [{name:"",email:""},{name:"",email:""}];
|
||||
var emptyInvitees = [{uuid: ''}];
|
||||
|
||||
Reference in New Issue
Block a user