mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 00:45:47 +01:00
closes #1595
This commit is contained in:
@@ -90,5 +90,8 @@
|
|||||||
"language": "Language",
|
"language": "Language",
|
||||||
|
|
||||||
"guest": "Guest",
|
"guest": "Guest",
|
||||||
"guests": "Guests"
|
"guests": "Guests",
|
||||||
|
|
||||||
|
"updated:title": "Forum Updated",
|
||||||
|
"updated:message": "This forum has just been updated to the latest version. Click here to refresh the page."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ var socket,
|
|||||||
'uid': null,
|
'uid': null,
|
||||||
'isFocused': true,
|
'isFocused': true,
|
||||||
'currentRoom': null,
|
'currentRoom': null,
|
||||||
'widgets': {}
|
'widgets': {},
|
||||||
|
'cacheBuster': null
|
||||||
};
|
};
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
@@ -51,7 +52,21 @@ var socket,
|
|||||||
|
|
||||||
app.enterRoom(room, true);
|
app.enterRoom(room, true);
|
||||||
|
|
||||||
socket.emit('meta.reconnected');
|
socket.emit('meta.reconnected', {}, function(err, cacheBuster) {
|
||||||
|
if (app.cacheBuster !== cacheBuster) {
|
||||||
|
app.cacheBuster = cacheBuster;
|
||||||
|
|
||||||
|
app.alert({
|
||||||
|
title: '[[global.updated:title]]',
|
||||||
|
message: '[[global.updated:message]]',
|
||||||
|
clickfn: function() {
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
type: 'warning'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$(window).trigger('action:reconnected');
|
$(window).trigger('action:reconnected');
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@@ -147,6 +162,8 @@ var socket,
|
|||||||
socket.emit('tools.log', arguments);
|
socket.emit('tools.log', arguments);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.cacheBuster = config['cache-buster'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ var fs = require('fs'),
|
|||||||
db = require('./database'),
|
db = require('./database'),
|
||||||
plugins = require('./plugins'),
|
plugins = require('./plugins'),
|
||||||
user = require('./user'),
|
user = require('./user'),
|
||||||
groups = require('./groups');
|
groups = require('./groups'),
|
||||||
|
emitter = require('./emitter');
|
||||||
|
|
||||||
(function (Meta) {
|
(function (Meta) {
|
||||||
Meta.restartRequired = false;
|
Meta.restartRequired = false;
|
||||||
@@ -326,6 +327,8 @@ var fs = require('fs'),
|
|||||||
Meta.js.cache = payload.data.js;
|
Meta.js.cache = payload.data.js;
|
||||||
Meta.js.map = payload.data.map;
|
Meta.js.map = payload.data.map;
|
||||||
minifier.kill();
|
minifier.kill();
|
||||||
|
|
||||||
|
emitter.emit('meta:js.compiled');
|
||||||
} else {
|
} else {
|
||||||
winston.error('[meta/js] Could not compile client-side scripts!');
|
winston.error('[meta/js] Could not compile client-side scripts!');
|
||||||
winston.error('[meta/js] ' + payload.error.message);
|
winston.error('[meta/js] ' + payload.error.message);
|
||||||
@@ -410,6 +413,7 @@ var fs = require('fs'),
|
|||||||
Meta.css.updateBranding();
|
Meta.css.updateBranding();
|
||||||
|
|
||||||
winston.info('[meta/css] Done.');
|
winston.info('[meta/css] Done.');
|
||||||
|
emitter.emit('meta:css.compiled');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ var meta = require('../meta'),
|
|||||||
topics = require('../topics'),
|
topics = require('../topics'),
|
||||||
logger = require('../logger'),
|
logger = require('../logger'),
|
||||||
plugins = require('../plugins'),
|
plugins = require('../plugins'),
|
||||||
|
emitter = require('../emitter'),
|
||||||
|
|
||||||
nconf = require('nconf'),
|
nconf = require('nconf'),
|
||||||
gravatar = require('gravatar'),
|
gravatar = require('gravatar'),
|
||||||
@@ -13,7 +14,7 @@ var meta = require('../meta'),
|
|||||||
rooms: {}
|
rooms: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
SocketMeta.reconnected = function(socket) {
|
SocketMeta.reconnected = function(socket, data, callback) {
|
||||||
var uid = socket.uid,
|
var uid = socket.uid,
|
||||||
sessionID = socket.id;
|
sessionID = socket.id;
|
||||||
|
|
||||||
@@ -22,6 +23,12 @@ SocketMeta.reconnected = function(socket) {
|
|||||||
user.notifications.pushCount(uid);
|
user.notifications.pushCount(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
emitter.on('nodebb:ready', function() {
|
||||||
|
callback(null, meta.config['cache-buster']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
if (uid) {
|
if (uid) {
|
||||||
winston.info('[socket] uid ' + uid + ' (' + sessionID + ') has successfully reconnected.');
|
winston.info('[socket] uid ' + uid + ' (' + sessionID + ') has successfully reconnected.');
|
||||||
|
|||||||
Reference in New Issue
Block a user