mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Filter out blank emails
This commit is contained in:
@@ -20,7 +20,9 @@ habitrpg.controller('InviteToGroupCtrl', ['$scope', 'User', 'Groups', 'injectedG
|
||||
|
||||
function _inviteByMethod(inviteMethod) {
|
||||
if (inviteMethod === 'email') {
|
||||
Groups.Group.invite({gid: $scope.group._id}, {inviter: $scope.inviter, emails: $scope.emails}, function(){
|
||||
var emails = _getEmails();
|
||||
|
||||
Groups.Group.invite({gid: $scope.group._id}, {inviter: $scope.inviter, emails: emails}, function(){
|
||||
Notification.text(window.env.t('invitationsSent'));
|
||||
_resetInvitees();
|
||||
}, function(){
|
||||
@@ -49,6 +51,14 @@ habitrpg.controller('InviteToGroupCtrl', ['$scope', 'User', 'Groups', 'injectedG
|
||||
return filteredUuids;
|
||||
}
|
||||
|
||||
function _getEmails() {
|
||||
var emails = _.filter($scope.emails, function(obj) {
|
||||
return obj.email != '';
|
||||
});
|
||||
console.log(emails);
|
||||
return emails;
|
||||
}
|
||||
|
||||
function _resetInvitees() {
|
||||
var emptyEmails = [{name:"",email:""},{name:"",email:""}];
|
||||
var emptyInvitees = [{uuid: ''}];
|
||||
|
||||
Reference in New Issue
Block a user