1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: emailservice now just returns if email was configured

This commit is contained in:
Christopher Kolstad 2021-04-23 15:24:32 +02:00
parent 7cb7e4a193
commit 97d77d84cc
2 changed files with 14 additions and 15 deletions

View File

@ -99,15 +99,18 @@ class FeatureToggleStore {
} }
async getProjectId(name) { async getProjectId(name) {
return this.db if (name) {
.first(['project']) return this.db
.from(TABLE) .first(['project'])
.where({ name }) .from(TABLE)
.then(r => (r ? r.project : undefined)) .where({ name })
.catch(e => { .then(r => (r ? r.project : undefined))
this.logger.error(e); .catch(e => {
return undefined; this.logger.error(e);
}); return undefined;
});
}
return undefined;
} }
async hasFeature(name) { async hasFeature(name) {

View File

@ -108,9 +108,8 @@ export default class UserAdminController extends Controller {
); );
const emailConfigured = this.emailService.configured(); const emailConfigured = this.emailService.configured();
let sentMetaData = null;
if (emailConfigured) { if (emailConfigured) {
sentMetaData = await this.emailService.sendGettingStartedMail( await this.emailService.sendGettingStartedMail(
createdUser.name, createdUser.name,
createdUser.email, createdUser.email,
inviteLink.toString(), inviteLink.toString(),
@ -121,13 +120,10 @@ export default class UserAdminController extends Controller {
); );
} }
const emailSent =
sentMetaData?.response.includes(MAIL_ACCEPTED) || false;
res.status(201).send({ res.status(201).send({
...createdUser, ...createdUser,
inviteLink, inviteLink,
emailSent, emailSent: emailConfigured,
rootRole, rootRole,
}); });
} catch (e) { } catch (e) {