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

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Mon May 4 15:26:55 UTC 2020


 loleaflet/src/control/Toolbar.js |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 8eb191036287084034f4d127bbdf3d147330ebf9
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Mon May 4 17:09:26 2020 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Mon May 4 17:26:35 2020 +0200

    Welcome: prevent the welcome message being circumvented
    
    * Repro:
            - Open a document on a welcome-message-enabled system
            - You'll get the message at this point, don't accept it
            - Close the app or browser, or navigate away
            - Open the file again
            -> No message, session opens
    
    * Now the cookie is created only when the dialog is closed
    
    Change-Id: Ifa3eb45a24747212a3b741c7a5277e16c70ed44e
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93426
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>

diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index 61d63eed3..c30abc500 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -345,7 +345,7 @@ L.Map.include({
 	},
 
 	// show the actual welcome dialog with the given data
-	_showWelcomeDialogVex: function(data) {
+	_showWelcomeDialogVex: function(data, calledFromMenu) {
 		var w;
 		var iw = window.innerWidth;
 		var hasDismissBtn = window.enableWelcomeMessageButton;
@@ -400,6 +400,12 @@ L.Map.include({
 				$('.vex-overlay').css({ 'pointer-events': 'none'});
 			},
 			beforeClose: function () {
+				if (!calledFromMenu) {
+					var WSDVerCookie = 'WSDWelcomeVersion=' + map._socket.WSDServer.Version;
+					// Cookie will not expire for a year, and it will not be sent to other domains
+					WSDVerCookie += '; max-age=31536000; SameSite=Strict; path=/loleaflet';
+					document.cookie = WSDVerCookie;
+				}
 				map.focus();
 				map.enable(true);
 			}
@@ -414,13 +420,7 @@ L.Map.include({
 		var map = this;
 		$.get(welcomeLocation)
 			.done(function(data) {
-				map._showWelcomeDialogVex(data);
-				if (!calledFromMenu) {
-					var WSDVerCookie = 'WSDWelcomeVersion=' + map._socket.WSDServer.Version;
-					// Cookie will not expire for a year, and it will not be sent to other domains
-					WSDVerCookie += '; max-age=31536000; SameSite=Strict; path=/loleaflet';
-					document.cookie = WSDVerCookie;
-				}
+				map._showWelcomeDialogVex(data, calledFromMenu);
 			})
 			.fail(function() {
 				// Welcome dialog disabled in loolwsd.xml or nonexistant for some other reason


More information about the Libreoffice-commits mailing list