diff --git a/src/lib/db/feature-toggle-store.js b/src/lib/db/feature-toggle-store.js index 55121b57a5..06537225ee 100644 --- a/src/lib/db/feature-toggle-store.js +++ b/src/lib/db/feature-toggle-store.js @@ -99,15 +99,18 @@ class FeatureToggleStore { } async getProjectId(name) { - return this.db - .first(['project']) - .from(TABLE) - .where({ name }) - .then(r => (r ? r.project : undefined)) - .catch(e => { - this.logger.error(e); - return undefined; - }); + if (name) { + return this.db + .first(['project']) + .from(TABLE) + .where({ name }) + .then(r => (r ? r.project : undefined)) + .catch(e => { + this.logger.error(e); + return undefined; + }); + } + return undefined; } async hasFeature(name) { diff --git a/src/lib/routes/admin-api/user-admin.ts b/src/lib/routes/admin-api/user-admin.ts index 9858a32261..5845ae91fb 100644 --- a/src/lib/routes/admin-api/user-admin.ts +++ b/src/lib/routes/admin-api/user-admin.ts @@ -108,9 +108,8 @@ export default class UserAdminController extends Controller { ); const emailConfigured = this.emailService.configured(); - let sentMetaData = null; if (emailConfigured) { - sentMetaData = await this.emailService.sendGettingStartedMail( + await this.emailService.sendGettingStartedMail( createdUser.name, createdUser.email, inviteLink.toString(), @@ -121,13 +120,10 @@ export default class UserAdminController extends Controller { ); } - const emailSent = - sentMetaData?.response.includes(MAIL_ACCEPTED) || false; - res.status(201).send({ ...createdUser, inviteLink, - emailSent, + emailSent: emailConfigured, rootRole, }); } catch (e) {