[Libreoffice-commits] online.git: loleaflet/src wsd/DocumentBroker.cpp

Pranav Kant pranavk at collabora.co.uk
Thu Jun 1 16:37:52 UTC 2017


 loleaflet/src/core/Socket.js |    3 +++
 wsd/DocumentBroker.cpp       |    8 +++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit a0710c9613309cb7be2934e8eedc75507185b87f
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Jun 1 22:02:08 2017 +0530

    Inform the current session about document change too
    
    Change-Id: I9947eb8b23e5a698cc2cbf39bfde4e1941aae0f0

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index e1cfde78..c0b53dca 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -282,6 +282,9 @@ L.Socket = L.Class.extend({
 				var username = textMsg.substring('documentconflict '.length);
 				msg = _('%user asked to refresh the document. Document will now refresh automatically.').replace('%user', username);
 
+				if (this._map._docLayer) {
+					this._map._docLayer.removeAllViews();
+				}
 				// Detach all the handlers from current socket, otherwise _onSocketClose tries to reconnect again
 				// However, we want to reconnect manually here.
 				this.close();
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index dfad745e..d92df509 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -497,11 +497,9 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
         {
             LOG_WRN("Document [" << _docKey << "] has been modified behind our back. Informing all clients.");
             _documentChangedInStorage = true;
-            // Inform all clients
-            for (const auto& sessionIt : _sessions)
-            {
-                sessionIt.second->sendTextFrame("error: cmd=storage kind=documentconflict");
-            }
+            const std::string errorMsg = "error: cmd=storage kind=documentconflict";
+            session->sendTextFrame(errorMsg);
+            broadcastMessage(errorMsg);
         }
     }
 


More information about the Libreoffice-commits mailing list