[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loleaflet/src wsd/DocumentBroker.cpp wsd/protocol.txt

Pranav Kant pranavk at collabora.co.uk
Tue Aug 1 12:14:57 UTC 2017


 loleaflet/src/core/Socket.js |    3 +--
 wsd/DocumentBroker.cpp       |   22 ++++++++++++++++++----
 wsd/protocol.txt             |    6 +++---
 3 files changed, 22 insertions(+), 9 deletions(-)

New commits:
commit c8e462fb6fd2b78e2d522a22005558f203dadced
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Jun 19 20:00:37 2017 +0530

    wsd: Don't show dialog if document is unmodified
    
    Change-Id: Ibb9e2122461c577863d1f713070748bdda6129d1
    (cherry picked from commit c88780b2d4d7b86810f24fecd5cc2aa8a04781e7)
    Reviewed-on: https://gerrit.libreoffice.org/40616
    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 88d3fd4d..2de5cceb 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -282,8 +282,7 @@ L.Socket = L.Class.extend({
 				}, timeoutMs);
 			}
 			else if (textMsg.startsWith('documentconflict')) {
-				var username = textMsg.substring('documentconflict '.length);
-				msg = _('%user asked to refresh the document. Document will now refresh automatically.').replace('%user', username);
+				msg = _('Document has changed in storage. Loading the new document. Your version is available as revision.');
 
 				if (this._map._docLayer) {
 					this._map._docLayer.removeAllViews();
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 46eef5e5..eb3fc099 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -511,9 +511,16 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
                          << "Actual: " << fileInfo._modifiedTime << Log::end;
 
             _documentChangedInStorage = true;
-            const std::string errorMsg = "error: cmd=storage kind=documentconflict";
-            session->sendTextFrame(errorMsg);
-            broadcastMessage(errorMsg);
+            if (_isModified)
+            {
+                const std::string errorMsg = "error: cmd=storage kind=documentconflict";
+                session->sendTextFrame(errorMsg);
+                broadcastMessage(errorMsg);
+            }
+            else
+            {
+                closeDocument("documentconflict");
+            }
         }
     }
 
@@ -675,7 +682,14 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId,
     {
         LOG_ERR("PutFile says that Document changed in storage");
         _documentChangedInStorage = true;
-        broadcastMessage("error: cmd=storage kind=documentconflict");
+        if (_isModified)
+        {
+            broadcastMessage("error: cmd=storage kind=documentconflict");
+        }
+        else
+        {
+            closeDocument("documentconflict");
+        }
     }
 
     return false;
diff --git a/wsd/protocol.txt b/wsd/protocol.txt
index e775a605..7ac54b68 100644
--- a/wsd/protocol.txt
+++ b/wsd/protocol.txt
@@ -277,9 +277,9 @@ close: <reason>
     shutting down to let clients know they can try connecting
     after a short interval.
 
-    * documentconflict <user name> - All sessions of this document are going down
-    because file was changed in storage and one of the user ( with <user
-    name>) asked to reload the session for all.
+    * documentconflict - All sessions of this document are going down
+    because file was changed in storage and we want to load the new document
+    from the storage.
 
 getchildid: id=<id>
 


More information about the Libreoffice-commits mailing list