[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-cd' - loleaflet/src

Pranav Kant pranavk at collabora.co.uk
Tue Aug 29 17:48:01 UTC 2017


 loleaflet/src/core/Socket.js |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit dabbebfa927119d17f71887688bff60bd2a40681
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/41571
    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 e37473be..4a41145e 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -229,21 +229,25 @@ 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 = _('Session was terminated due to idleness - please click to reload');
 				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 === 'recycling') {
 				msg = _('Server is recycling and will be available shortly');
-
 				this._map._active = false;
 				this._map._serverRecycling = true;
 
@@ -316,9 +320,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