From 0dee3ac480a243150e1b2be3262383083fd3f5a1 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Mon, 23 Jul 2018 12:23:41 +0200
Subject: [PATCH] when there is no google api key defined parameter is not
 entered to the url

---
 CHANGELOG                                 | 8 ++++++++
 frontend-js/.idea/frontend-js.iml         | 6 ++++++
 frontend-js/src/main/js/minerva.js        | 4 ++--
 persist/src/db/11.1.3/fix_db_20180723.sql | 1 +
 web/src/main/webapp/login.xhtml           | 2 +-
 5 files changed, 18 insertions(+), 3 deletions(-)
 create mode 100644 persist/src/db/11.1.3/fix_db_20180723.sql

diff --git a/CHANGELOG b/CHANGELOG
index 557a552a17..79c6437f70 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,11 @@
+minerva (11.1.3) stable; urgency=medium
+  * Bug fix RPM: remove directory with contents of unpacked war file
+    when uninstalling
+  * Bug fix: don't append Google API key to Google maps javascript URL
+    when it is not set
+
+ -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 23 Jul 2018 16:00:00 +0200
+
 minerva (11.1.2) stable; urgency=medium
   * Bug fix: Searching for chemicals with invalid mesh ID crashed 
   * Bug fix: opening map that was removed and re-uploaded could crash 
diff --git a/frontend-js/.idea/frontend-js.iml b/frontend-js/.idea/frontend-js.iml
index 832c99755b..f97e84fc8b 100644
--- a/frontend-js/.idea/frontend-js.iml
+++ b/frontend-js/.idea/frontend-js.iml
@@ -11,5 +11,11 @@
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="library" name="chai-DefinitelyTyped" level="application" />
     <orderEntry type="library" name="js-cookie-DefinitelyTyped" level="application" />
+    <orderEntry type="library" name="@types/ol" level="application" />
+    <orderEntry type="library" name="datatables.net-DefinitelyTyped" level="application" />
+    <orderEntry type="library" name="jQuery UI-1.10.2" level="application" />
+    <orderEntry type="library" name="jQuery-2.0.0" level="application" />
+    <orderEntry type="library" name="mocha-DefinitelyTyped" level="application" />
+    <orderEntry type="library" name="request-DefinitelyTyped" level="application" />
   </component>
 </module>
\ No newline at end of file
diff --git a/frontend-js/src/main/js/minerva.js b/frontend-js/src/main/js/minerva.js
index e145a36c91..13775a7646 100644
--- a/frontend-js/src/main/js/minerva.js
+++ b/frontend-js/src/main/js/minerva.js
@@ -518,7 +518,7 @@ function create(params) {
     return ServerConnector.getConfiguration();
   }).then(function (configuration) {
     params.setConfiguration(configuration);
-    return functions.loadScript("https://maps.google.com/maps/api/js?libraries=drawing&v=3.26&key=" + configuration.getOption(ConfigurationType.GOOGLE_MAPS_API_KEY));
+    return functions.loadScript("https://maps.google.com/maps/api/js?libraries=drawing&v=3.26" + (configuration.getOption(ConfigurationType.GOOGLE_MAPS_API_KEY)?'&key='+configuration.getOption(ConfigurationType.GOOGLE_MAPS_API_KEY):''));
   }).then(function () {
     return getProject(params);
   }).then(function (project) {
@@ -639,7 +639,7 @@ function createExport(params) {
     return ServerConnector.getConfiguration();
   }).then(function (configuration) {
     params.setConfiguration(configuration);
-    return functions.loadScript("https://maps.google.com/maps/api/js?libraries=drawing&v=3.26&key=" + configuration.getOption(ConfigurationType.GOOGLE_MAPS_API_KEY));
+    return functions.loadScript("https://maps.google.com/maps/api/js?libraries=drawing&v=3.26" + (configuration.getOption(ConfigurationType.GOOGLE_MAPS_API_KEY)?'&key='+configuration.getOption(ConfigurationType.GOOGLE_MAPS_API_KEY):''));
   }).then(function () {
     return getProject(params);
   }).then(function (project) {
diff --git a/persist/src/db/11.1.3/fix_db_20180723.sql b/persist/src/db/11.1.3/fix_db_20180723.sql
new file mode 100644
index 0000000000..a33b6ad89d
--- /dev/null
+++ b/persist/src/db/11.1.3/fix_db_20180723.sql
@@ -0,0 +1 @@
+-- empty file to force directory to be commited to git repo
diff --git a/web/src/main/webapp/login.xhtml b/web/src/main/webapp/login.xhtml
index 109c6d5cf8..c9631660e0 100644
--- a/web/src/main/webapp/login.xhtml
+++ b/web/src/main/webapp/login.xhtml
@@ -74,7 +74,7 @@
 	            var head = document.getElementsByTagName('head')[0];
 	            var script = document.createElement('script');
 	            script.type = 'text/javascript';
-	            script.src = "https://maps.google.com/maps/api/js?libraries=drawing&v=3.26&key=" + configuration.getOption("GOOGLE_MAPS_API_KEY");
+                    script.src = "https://maps.google.com/maps/api/js?libraries=drawing&v=3.26" + (configuration.getOption("GOOGLE_MAPS_API_KEY")?'&key='+configuration.getOption("GOOGLE_MAPS_API_KEY"):'');
 	            head.appendChild(script);
     	    });
         }
-- 
GitLab