allowed the "forum updated" message to show up for reloads as well

v1.18.x
Julian Lam 11 years ago
parent dc0cec0352
commit 5f96823f66

@ -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'
});
}
});
});
};

@ -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... <i class="fa fa-spin fa-refresh"></i>',
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: '<i class="fa fa-check"></i> 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... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is restarting.',
type: 'info',
title: 'Reloading... <i class="fa fa-spin fa-refresh"></i>',
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: '<i class="fa fa-check"></i> 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
});
}
});

@ -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);
});
});
};

@ -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) {

Loading…
Cancel
Save