configure.ac                     |   10 ++++++++++
 loleaflet/html/loleaflet.html.m4 |    2 ++
 loleaflet/src/control/Toolbar.js |    5 ++++-
 loolwsd.xml.in                   |    2 +-
 wsd/FileServer.cpp               |    5 +++++
 5 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit c234fe777964d659aacff085ce75d883d7230e5b
Author:     Muhammet Kara <muhammet.k...@collabora.com>
AuthorDate: Thu Apr 16 00:59:43 2020 +0300
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Thu Apr 16 14:30:32 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 <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92356
    Tested-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index 12407c34b..553f1cca5 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 9c4bd8ba4..12a37eabf 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -737,6 +737,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;
commit 96c6ef66d75d303559b748c17f8d1414113e1e70
Author:     Jan Holesovsky <ke...@collabora.com>
AuthorDate: Wed Apr 15 16:17:31 2020 +0200
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Thu Apr 16 14:30:16 2020 +0200

    Welcome: Add ./configure of the welcome message default.
    
    Change-Id: I090c7d657d2b0a696117f64f25c11ffb249fb272
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92277
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92355
    Tested-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/configure.ac b/configure.ac
index 092998061..6ba0b045c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,6 +258,11 @@ AC_ARG_WITH([max-documents],
              AS_HELP_STRING([--with-max-documents],
                            [Set the limit on the total number of documents. 
Def: 10, Min: 2.]))
 
+AC_ARG_ENABLE(welcome-message,
+    AS_HELP_STRING([--enable-welcome-message],
+        [Enables welcome message on version update. Can be changed later in 
loolwsd.xml.])
+)
+
 AC_ARG_WITH([sanitizer],
              AS_HELP_STRING([--with-sanitizer],
                            [Enable one or more compatible sanitizers. E.g. 
--with-sanitizer=address,undefined,leak]))
@@ -593,6 +598,11 @@ AS_IF([test "$MAX_DOCUMENTS" -lt "2"],
 AC_DEFINE_UNQUOTED([MAX_DOCUMENTS],[$MAX_DOCUMENTS],[Limit the maximum number 
of open documents])
 AC_SUBST(MAX_DOCUMENTS)
 
+ENABLE_WELCOME_MESSAGE=false
+AS_IF([test "$enable_welcome_message" = "yes"],
+      [ENABLE_WELCOME_MESSAGE="true"])
+AC_SUBST(ENABLE_WELCOME_MESSAGE)
+
 VEREIGN_URL=
 if test "$enable_vereign" = "yes"; then
     VEREIGN_URL="https://app.vereign.com";
diff --git a/loolwsd.xml.in b/loolwsd.xml.in
index 1739a661f..d22ec7e98 100644
--- a/loolwsd.xml.in
+++ b/loolwsd.xml.in
@@ -115,7 +115,7 @@
     </watermark>
 
     <welcome>
-      <enable type="bool" desc="Controls whether the welcome screen should be 
shown to the users on new install and updates." default="true">true</enable>
+      <enable type="bool" desc="Controls whether the welcome screen should be 
shown to the users on new install and updates." 
default="@ENABLE_WELCOME_MESSAGE@">@ENABLE_WELCOME_MESSAGE@</enable>
       <path desc="Path to 'welcome-$lang.html' files served on first start or 
when the version changes. When empty, defaults to the Release notes." 
type="path" relative="true" default="loleaflet/welcome"></path>
     </welcome>
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to