[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loleaflet/src
Pranav Kant
pranavk at collabora.co.uk
Wed Sep 20 13:04:21 UTC 2017
loleaflet/src/core/Socket.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
New commits:
commit afa5c78e1526b735f82e97c68168eeb0c35b4573
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Fri Aug 25 17:38:26 2017 +0530
loleaflet: Mention the reason of closing websocket to WOPI hosts
Reason is part of the JSON of post message with ID, 'Session_Close'.
Change-Id: I51a465f63fbd80843292a3f19c5b89f920301194
(cherry picked from commit 29aef0af4b5c2a883131f60c7cea5f13eddf48f6)
Reviewed-on: https://gerrit.libreoffice.org/41570
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 8e7ff652..5e6b3819 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -248,17 +248,22 @@ L.Socket = L.Class.extend({
else if (textMsg.startsWith('close: ')) {
textMsg = textMsg.substring('close: '.length);
msg = '';
-
+ var postMsgData = {};
// This is due to document owner terminating the session
if (textMsg === 'ownertermination') {
msg = _('Session terminated by document owner');
+ postMsgData['Reason'] = 'OwnerTermination';
}
else if (textMsg === 'idle' || textMsg === 'oom') {
msg = _('Idle document - please click to reload and resume editing');
this._map._documentIdle = true;
+ postMsgData['Reason'] = 'DocumentIdle';
+ if (textMsg === 'oom')
+ postMsgData['Reason'] = 'OOM';
}
else if (textMsg === 'shuttingdown') {
msg = _('Server is shutting down for maintenance (auto-saving)');
+ postMsgData['Reason'] = 'ShuttingDown';
}
else if (textMsg === 'docdisconnected') {
msg = _('Oops, there is a problem connecting the document');
@@ -266,7 +271,6 @@ L.Socket = L.Class.extend({
}
else if (textMsg === 'recycling') {
msg = _('Server is recycling and will be available shortly');
-
this._map._active = false;
this._map._serverRecycling = true;
@@ -365,9 +369,9 @@ L.Socket = L.Class.extend({
$(options.appendLocation).append(options.$vex);
vex.setupBodyClassName(options.$vex);
- if (textMsg !== 'shuttingdown') {
+ if (postMsgData['Reason']) {
// Tell WOPI host about it which should handle this situation
- this._map.fire('postMessage', {msgId: 'Session_Closed'});
+ this._map.fire('postMessage', {msgId: 'Session_Closed', args: postMsgData});
}
if (textMsg === 'ownertermination') {
More information about the Libreoffice-commits
mailing list