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

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 27 10:27:45 UTC 2020


 loleaflet/src/control/Control.Toolbar.js |   12 +++++++-----
 loleaflet/src/layer/tile/TileLayer.js    |   24 ++++++++++++------------
 2 files changed, 19 insertions(+), 17 deletions(-)

New commits:
commit 73c8b3dd533804147c60cbc41c78de74e3261dac
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Thu Mar 26 20:27:06 2020 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Mar 27 11:27:24 2020 +0100

    user list: Make sure it shows in the non-wopi case.
    
    When the WOPI does not contain the HideUserList, or when there is no
    WOPI involved, we should show the list.
    
    Makes the condititon slightly more readable too I hope.
    
    Change-Id: I801df07e6bcae9362c36182ac88e503fbcd29513
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91153
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 6ac3cbd26..6df3d20ea 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -1174,11 +1174,13 @@ function initNormalToolbar() {
 				$('#tb_actionbar_item_userlist .w2ui-tb-caption').addClass('loleaflet-font');
 				setupSearchInput();
 
-				var showInDesktop = map['wopi'].HideUserList !== null &&
-									map['wopi'].HideUserList !== undefined &&
-									$.inArray('true', map['wopi'].HideUserList) < 0 &&
-									$.inArray('desktop', map['wopi'].HideUserList) < 0;
-				if (this.get('userlist') && this.get('userlist').hidden == true && showInDesktop) {
+				var hideInDesktop =
+					map['wopi'].HideUserList !== null &&
+					map['wopi'].HideUserList !== undefined &&
+					($.inArray('true', map['wopi'].HideUserList) >= 0 ||
+					 $.inArray('desktop', map['wopi'].HideUserList) >= 0);
+
+				if (this.get('userlist') && this.get('userlist').hidden === true && !hideInDesktop) {
 					this.show('userlist');
 					this.show('userlistbreak');
 					map.on('deselectuser', deselectUser);
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index c40b2fd3d..f3dc74503 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1418,32 +1418,32 @@ L.TileLayer = L.GridLayer.extend({
 	},
 
 	_onUserListRefresh: function(map, toolbar) {
-		var showUserList = map['wopi'].HideUserList !== null &&
-							map['wopi'].HideUserList !== undefined &&
-							$.inArray('true', map['wopi'].HideUserList) < 0 &&
-							!window.ThisIsAMobileApp &&
-							((window.mode.isMobile() && $.inArray('mobile', map['wopi'].HideUserList) < 0) ||
-							(window.mode.isTablet() && $.inArray('tablet', map['wopi'].HideUserList) < 0));
+		var hideUserList =
+			window.ThisIsAMobileApp ||
+			(map['wopi'].HideUserList !== null && map['wopi'].HideUserList !== undefined &&
+				($.inArray('true', map['wopi'].HideUserList) >= 0) ||
+				(window.mode.isMobile() && $.inArray('mobile', map['wopi'].HideUserList) >= 0) ||
+				(window.mode.isTablet() && $.inArray('tablet', map['wopi'].HideUserList) >= 0));
 
 		// Otherwise we can get an infinte, fast busy timeout loop.
-		if (toolbar.get('userlist').hidden == !showUserList)
+		if (toolbar.get('userlist').hidden == hideUserList)
 			return;
 
 		map.off('deselectuser', window.deselectUser);
 		map.off('addview', window.onAddView);
 		map.off('removeview', window.onRemoveView);
 
-		if (showUserList) {
+		if (hideUserList) {
+			toolbar.hide('userlist');
+			toolbar.hide('userlistbreak');
+		}
+		else {
 			toolbar.show('userlist');
 			toolbar.show('userlistbreak');
 			map.on('deselectuser', window.deselectUser);
 			map.on('addview', window.onAddView);
 			map.on('removeview', window.onRemoveView);
 		}
-		else {
-			toolbar.hide('userlist');
-			toolbar.hide('userlistbreak');
-		}
 	},
 
 	_onRenderFontMsg: function (textMsg, img) {


More information about the Libreoffice-commits mailing list