Listen to mail config change event correctly
This commit is contained in:
+5
-3
@@ -34,11 +34,15 @@ var apps = require('./apps.js'),
|
||||
var gAddonVars = null,
|
||||
gPlatformReadyTimer = null;
|
||||
|
||||
var NOOP_CALLBACK = function (error) { if (error) debug(error); };
|
||||
|
||||
function initialize(callback) {
|
||||
if (process.env.BOX_ENV === 'test' && !process.env.CREATE_INFRA) return callback();
|
||||
|
||||
debug('initializing addon infrastructure');
|
||||
|
||||
settings.events.on(settings.MAIL_CONFIG_KEY, function () { startMail(NOOP_CALLBACK); });
|
||||
|
||||
var existingInfra = { version: 'none' };
|
||||
if (fs.existsSync(paths.INFRA_VERSION_FILE)) {
|
||||
existingInfra = safe.JSON.parse(fs.readFileSync(paths.INFRA_VERSION_FILE, 'utf8'));
|
||||
@@ -74,8 +78,6 @@ function initialize(callback) {
|
||||
exports.events.emit(exports.EVENT_READY);
|
||||
}, 30000);
|
||||
|
||||
settings.events.on(exports.MAIL_CONFIG_KEY, startMail);
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
@@ -83,7 +85,7 @@ function initialize(callback) {
|
||||
function uninitialize(callback) {
|
||||
clearTimeout(gPlatformReadyTimer);
|
||||
gPlatformReadyTimer = null;
|
||||
settings.events.removeListener(exports.MAIL_CONFIG_KEY, startMail);
|
||||
settings.events.removeListener(settings.MAIL_CONFIG_KEY, startMail);
|
||||
callback();
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
Email server can only be enabled for custom domains.
|
||||
</p>
|
||||
|
||||
<div class="col-xs-6 text-right" ng-show="config.isCustomDomain">
|
||||
<div class="col-md-12" ng-show="!config.isCustomDomain">
|
||||
<button class="btn btn-primary pull-right" ng-click="toggleEmail()" ng-enabled="mailConfig">{{ mailConfig.enabled ? "Disable Email" : "Enable Email" }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user