diff --git a/public/src/app.js b/public/src/app.js index 64e5e3e15c..b84a528764 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -54,23 +54,6 @@ var socket, socket.emit('meta.reconnected'); - socket.removeAllListeners('event:nodebb.ready'); - socket.on('event:nodebb.ready', function(cacheBuster) { - if (app.cacheBuster !== cacheBuster) { - app.cacheBuster = cacheBuster; - - app.alert({ - alert_id: 'forum_updated', - title: '[[global:updated.title]]', - message: '[[global:updated.message]]', - clickfn: function() { - window.location.reload(); - }, - type: 'warning' - }); - } - }); - $(window).trigger('action:reconnected'); setTimeout(function() { @@ -542,6 +525,28 @@ var socket, }); }); }); + + socket.removeAllListeners('event:nodebb.ready'); + socket.on('event:nodebb.ready', function(cacheBusters) { + if ( + !app.cacheBusters || + app.cacheBusters.general !== cacheBusters.general || + app.cacheBusters.css !== cacheBusters.css || + app.cacheBusters.js !== cacheBusters.js + ) { + app.cacheBusters = cacheBusters; + + app.alert({ + alert_id: 'forum_updated', + title: '[[global:updated.title]]', + message: '[[global:updated.message]]', + clickfn: function() { + window.location.reload(); + }, + type: 'warning' + }); + } + }); }); }; diff --git a/public/src/forum/admin/index.js b/public/src/forum/admin/index.js index 58eb0d8eef..031cfb0049 100644 --- a/public/src/forum/admin/index.js +++ b/public/src/forum/admin/index.js @@ -40,14 +40,21 @@ define('forum/admin/index', function() { bootbox.confirm('Are you sure you wish to restart NodeBB?', function(confirm) { if (confirm) { app.alert({ - timeout: 5000, + alert_id: 'instance_restart', + type: 'info', title: 'Restarting... ', message: 'NodeBB is restarting.', - type: 'info' + timeout: 5000 }); $(window).one('action:reconnected', function() { - app.alertSuccess('NodeBB has successfully restarted.'); + app.alert({ + alert_id: 'instance_restart', + type: 'success', + title: ' Success', + message: 'NodeBB has successfully restarted.', + timeout: 5000 + }); }); socket.emit('admin.restart'); @@ -58,21 +65,27 @@ define('forum/admin/index', function() { $('.reload').on('click', function() { app.alert({ alert_id: 'instance_reload', - title: 'Reloading... ', - message: 'NodeBB is restarting.', type: 'info', + title: 'Reloading... ', + message: 'NodeBB is reloading.', timeout: 5000 }); socket.emit('admin.reload', function(err) { if (!err) { - app.alertSuccess('NodeBB has successfully reloaded.'); + app.alert({ + alert_id: 'instance_reload', + type: 'success', + title: ' Success', + message: 'NodeBB has successfully reloaded.', + timeout: 5000 + }); } else { app.alert({ alert_id: 'instance_reload', + type: 'danger', title: '[[global:alert.error]]', - message: err.message, - type: 'danger' + message: err.message }); } }); diff --git a/src/meta.js b/src/meta.js index 9a616cc957..949f81d88f 100644 --- a/src/meta.js +++ b/src/meta.js @@ -4,8 +4,8 @@ var async = require('async'), winston = require('winston'), user = require('./user'), groups = require('./groups'), - plugins = require('./plugins'); - + plugins = require('./plugins'), + emitter = require('./emitter'); (function (Meta) { Meta.restartRequired = false; @@ -34,7 +34,10 @@ var async = require('async'), async.parallel([ async.apply(Meta.js.minify, false), async.apply(Meta.css.minify) - ], callback); + ], function() { + emitter.emit('nodebb:ready'); + callback.apply(null, arguments); + }); }); }; diff --git a/src/socket.io/meta.js b/src/socket.io/meta.js index 005f32fdfc..107e645569 100644 --- a/src/socket.io/meta.js +++ b/src/socket.io/meta.js @@ -35,7 +35,11 @@ SocketMeta.reconnected = function(socket, data, callback) { }; emitter.on('nodebb:ready', function() { - websockets.server.sockets.emit('event:nodebb.ready', meta.config['cache-buster']); + websockets.server.sockets.emit('event:nodebb.ready', { + general: meta.config['cache-buster'], + css: meta.css.hash, + js: meta.js.hash + }); }); SocketMeta.buildTitle = function(socket, text, callback) {