loleaflet/html/loleaflet.html.m4 |    2 ++
 loleaflet/src/control/Toolbar.js |    5 ++++-
 wsd/FileServer.cpp               |    5 +++++
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit aaf1fa4fc610323fd539d1480ef057e123f98790
Author:     Muhammet Kara <[email protected]>
AuthorDate: Thu Apr 16 00:59:43 2020 +0300
Commit:     Jan Holesovsky <[email protected]>
CommitDate: Thu Apr 16 11:37:08 2020 +0200

    Welcome: Pass welcome value from loolwsd.xml to the JS side
    
    Now we have window.enableWelcomeMessage on the JS side to avoid any
    queries at all when the feature is disabled.
    
    Change-Id: I8420089f775bfbf5bcd557c7c720172fbce8c22e
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92338
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Jan Holesovsky <[email protected]>

diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index dca62ada1..c8d51f0f0 100644
--- a/loleaflet/html/loleaflet.html.m4
+++ b/loleaflet/html/loleaflet.html.m4
@@ -234,6 +234,7 @@ m4_ifelse(MOBILEAPP,[true],
       window.accessTokenTTL = '';
       window.accessHeader = '';
       window.loleafletLogging = 'true';
+      window.enableWelcomeMessage = false;
       window.outOfFocusTimeoutSecs = 1000000;
       window.idleTimeoutSecs = 1000000;
       window.reuseCookies = '';
@@ -246,6 +247,7 @@ m4_ifelse(MOBILEAPP,[true],
       window.accessTokenTTL = '%ACCESS_TOKEN_TTL%';
       window.accessHeader = '%ACCESS_HEADER%';
       window.loleafletLogging = '%LOLEAFLET_LOGGING%';
+      window.enableWelcomeMessage = %ENABLE_WELCOME_MSG%;
       window.outOfFocusTimeoutSecs = %OUT_OF_FOCUS_TIMEOUT_SECS%;
       window.idleTimeoutSecs = %IDLE_TIMEOUT_SECS%;
       window.reuseCookies = '%REUSE_COOKIES%';
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index e6f1a7e6f..4e17dece2 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -424,12 +424,15 @@ L.Map.include({
        },
 
        shouldWelcome: function() {
+               if (!window.enableWelcomeMessage || L.Browser.cypressTest)
+                       return false;
+
                var currentVerCookie = this.getCookie('WSDWelcomeVersion');
                var newVerCookie = 'WSDWelcomeVersion=' + 
this._socket.WSDServer.Version;
                var welcomeDisabledCookie = 
this.getCookie('WSDWelcomeDisabled');
                var isWelcomeDisabled = welcomeDisabledCookie === 
'WSDWelcomeDisabled=true';
 
-               if (currentVerCookie !== newVerCookie && !isWelcomeDisabled && 
!L.Browser.cypressTest) {
+               if (currentVerCookie !== newVerCookie && !isWelcomeDisabled) {
                        return true;
                }
 
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 027655dc9..5a973bc01 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -736,6 +736,11 @@ void FileServerRequestHandler::preprocessFile(const 
HTTPRequest& request, Poco::
     const std::string idleTimeoutSecs= 
config.getString("per_view.idle_timeout_secs", "900");
     Poco::replaceInPlace(preprocess, std::string("%IDLE_TIMEOUT_SECS%"), 
idleTimeoutSecs);
 
+    std::string enableWelcomeMessage = "false";
+    if (config.getBool("welcome.enable", false))
+        enableWelcomeMessage = "true";
+    Poco::replaceInPlace(preprocess, std::string("%ENABLE_WELCOME_MSG%"), 
enableWelcomeMessage);
+
     // Capture cookies so we can optionally reuse them for the storage 
requests.
     {
         NameValueCollection cookies;
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to