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

Pranav Kant pranavk at collabora.co.uk
Thu Jun 22 11:13:07 UTC 2017


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

New commits:
commit eb7fcd66074785cf37a522922d92105b52ce2c2a
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
    (cherry picked from commit a0710c9613309cb7be2934e8eedc75507185b87f)
    Reviewed-on: https://gerrit.libreoffice.org/38534
    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 fa03820a..444abe62 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -285,6 +285,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 850baf66..cd7c3438 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -495,11 +495,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