mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
tweaking
This commit is contained in:
parent
f007037bc5
commit
b8f9dbe55f
@ -85,7 +85,7 @@ export class ConfigDiagnostics {
|
||||
private static async testEmailMessagingConfig(Messaging: MessagingConfig, config: PrivateConfigClass): Promise<void> {
|
||||
Logger.debug(LOG_TAG, 'Testing EmailMessaging config');
|
||||
|
||||
if (Messaging.Email.type === EmailMessagingType.sendmail && !Config.Environment.sendMailAvailable) {
|
||||
if (Messaging.Email.type === EmailMessagingType.sendmail && ServerEnvironment.sendMailAvailable === false) {
|
||||
throw new Error('sendmail e-mail sending method is not supported as the sendmail application cannot be found in the OS.');
|
||||
}
|
||||
}
|
||||
@ -306,12 +306,12 @@ export class ConfigDiagnostics {
|
||||
sendmail: true,
|
||||
});
|
||||
try {
|
||||
Config.Environment.sendMailAvailable = await transporter.verify();
|
||||
ServerEnvironment.sendMailAvailable = await transporter.verify();
|
||||
} catch (e) {
|
||||
Config.Environment.sendMailAvailable = false;
|
||||
ServerEnvironment.sendMailAvailable = false;
|
||||
}
|
||||
ServerEnvironment.sendMailAvailable = Config.Environment.sendMailAvailable;
|
||||
if (!Config.Environment.sendMailAvailable) {
|
||||
Config.Environment.sendMailAvailable = ServerEnvironment.sendMailAvailable;
|
||||
if (!ServerEnvironment.sendMailAvailable) {
|
||||
Config.Messaging.Email.type = EmailMessagingType.SMTP;
|
||||
Logger.info(LOG_TAG, 'Sendmail is not available on the OS. You will need to use an SMTP server if you wish the app to send mails.');
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ describe('Settings middleware', () => {
|
||||
it('should save enforced users settings', (done: (err?: any) => void) => {
|
||||
|
||||
ServerEnvironment.sendMailAvailable = false;
|
||||
Config.Environment.sendMailAvailable = false
|
||||
Config.Environment.sendMailAvailable = false;
|
||||
Config.Messaging.Email.type = EmailMessagingType.sendmail;
|
||||
const req: any = {
|
||||
session: {},
|
||||
@ -80,9 +80,14 @@ describe('Settings middleware', () => {
|
||||
expect(Config.Users.enforcedUsers[0].name).to.be.equal('Apple');
|
||||
expect(Config.Users.enforcedUsers.length).to.be.equal(1);
|
||||
Config.original().then((cfg) => {
|
||||
expect(cfg.Users.enforcedUsers.length).to.be.equal(1);
|
||||
expect(cfg.Users.enforcedUsers[0].name).to.be.equal('Apple');
|
||||
done();
|
||||
try {
|
||||
expect(cfg.Users.enforcedUsers.length).to.be.equal(1);
|
||||
expect(cfg.Users.enforcedUsers[0].name).to.be.equal('Apple');
|
||||
done();
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
done(err);
|
||||
}
|
||||
}).catch(done);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
Loading…
Reference in New Issue
Block a user