Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit f7006fa

Browse files
authored
Fix crash on bulk-apply when you're not a ticketing admin (#190)
1 parent 2f8faac commit f7006fa

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/bulk-apply-applications.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ function bulkApplyApplications (args, callback) {
9393
} else {
9494
seneca.act({role: 'cd-dojos', cmd: 'load_usersdojos', query: {userId: requestingUser.id, dojoId: eventData.dojoId}}, function (err, usersDojos) {
9595
if (err) return done(err);
96-
var userDojo = usersDojos[0];
97-
var isTicketingAdmin = _.find(userDojo.userPermissions, function (userPermission) {
98-
return userPermission.name === 'ticketing-admin';
99-
});
96+
if (usersDojos.length > 0) {
97+
var userDojo = usersDojos[0];
98+
var isTicketingAdmin = _.find(userDojo.userPermissions, function (userPermission) {
99+
return userPermission.name === 'ticketing-admin';
100+
});
101+
}
100102
if (!isTicketingAdmin) return done(new Error('You must be a ticketing admin of this Dojo to update applications.'));
101103
return done();
102104
});

0 commit comments

Comments
 (0)