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,
|
var gAddonVars = null,
|
||||||
gPlatformReadyTimer = null;
|
gPlatformReadyTimer = null;
|
||||||
|
|
||||||
|
var NOOP_CALLBACK = function (error) { if (error) debug(error); };
|
||||||
|
|
||||||
function initialize(callback) {
|
function initialize(callback) {
|
||||||
if (process.env.BOX_ENV === 'test' && !process.env.CREATE_INFRA) return callback();
|
if (process.env.BOX_ENV === 'test' && !process.env.CREATE_INFRA) return callback();
|
||||||
|
|
||||||
debug('initializing addon infrastructure');
|
debug('initializing addon infrastructure');
|
||||||
|
|
||||||
|
settings.events.on(settings.MAIL_CONFIG_KEY, function () { startMail(NOOP_CALLBACK); });
|
||||||
|
|
||||||
var existingInfra = { version: 'none' };
|
var existingInfra = { version: 'none' };
|
||||||
if (fs.existsSync(paths.INFRA_VERSION_FILE)) {
|
if (fs.existsSync(paths.INFRA_VERSION_FILE)) {
|
||||||
existingInfra = safe.JSON.parse(fs.readFileSync(paths.INFRA_VERSION_FILE, 'utf8'));
|
existingInfra = safe.JSON.parse(fs.readFileSync(paths.INFRA_VERSION_FILE, 'utf8'));
|
||||||
@@ -74,8 +78,6 @@ function initialize(callback) {
|
|||||||
exports.events.emit(exports.EVENT_READY);
|
exports.events.emit(exports.EVENT_READY);
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
||||||
settings.events.on(exports.MAIL_CONFIG_KEY, startMail);
|
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -83,7 +85,7 @@ function initialize(callback) {
|
|||||||
function uninitialize(callback) {
|
function uninitialize(callback) {
|
||||||
clearTimeout(gPlatformReadyTimer);
|
clearTimeout(gPlatformReadyTimer);
|
||||||
gPlatformReadyTimer = null;
|
gPlatformReadyTimer = null;
|
||||||
settings.events.removeListener(exports.MAIL_CONFIG_KEY, startMail);
|
settings.events.removeListener(settings.MAIL_CONFIG_KEY, startMail);
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,7 @@
|
|||||||
Email server can only be enabled for custom domains.
|
Email server can only be enabled for custom domains.
|
||||||
</p>
|
</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>
|
<button class="btn btn-primary pull-right" ng-click="toggleEmail()" ng-enabled="mailConfig">{{ mailConfig.enabled ? "Disable Email" : "Enable Email" }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user