[Libreoffice-commits] online.git: 2 commits - .gitignore loleaflet/src wsd/DocumentBroker.cpp wsd/protocol.txt

Pranav Kant pranavk at collabora.co.uk
Mon Jun 19 14:31:57 UTC 2017


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

New commits:
commit c88780b2d4d7b86810f24fecd5cc2aa8a04781e7
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

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 444abe62..433c0318 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 71af4b19..240c1d40 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -526,9 +526,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");
+            }
         }
     }
 
@@ -690,7 +697,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 4ecd8378..eaa30727 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>
 
commit a24475f5dd842a3b345d2a0ce5593b129304ab74
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jun 16 20:40:55 2017 +0530

    .gitignore tags files
    
    Change-Id: I004e55ed6b2ba94071824c95a6c4d508f9c56ef8

diff --git a/.gitignore b/.gitignore
index 9c22fec4..35ce86c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,5 +63,7 @@ loolwsd_fuzzer
 clientnb
 
 # make tags
+tags
+test/tags
 TAGS
 test/TAGS


More information about the Libreoffice-commits mailing list