summaryrefslogtreecommitdiff
path: root/addons/web_unsplash/static
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2018-11-05 16:45:49 +0000
committerRomain Derie <rde@odoo.com>2018-11-05 17:02:34 +0000
commitf9e34d98f1df23897eda4b29de737c79a441d69b (patch)
tree24a61ec723c4f3a9e68242dbe90f0b7b0e1e1851 /addons/web_unsplash/static
parent4f8ed012c45e65172be6a8d7a24f078d0545d791 (diff)
[FIX] web_unsplash: do not fetch app_id if no Unsplash images
As empty arrays are considered truthy, the call to `/web_unsplash/get_app_id` would always be performed even if no Unsplash images. closes odoo/odoo#28421
Diffstat (limited to 'addons/web_unsplash/static')
-rw-r--r--addons/web_unsplash/static/src/js/unsplash_beacon.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/web_unsplash/static/src/js/unsplash_beacon.js b/addons/web_unsplash/static/src/js/unsplash_beacon.js
index d287a3dd80d..f8e74a3b759 100644
--- a/addons/web_unsplash/static/src/js/unsplash_beacon.js
+++ b/addons/web_unsplash/static/src/js/unsplash_beacon.js
@@ -10,7 +10,7 @@ base.ready().then(function () {
// get image id from URL (`/unsplash/xYdf5feoI.jpg` -> `xYdf5feoI`)
unsplash_images.push(img.src.split('/unsplash/')[1].split('.')[0]);
});
- if (unsplash_images) {
+ if (unsplash_images.length) {
ajax.jsonRpc('/web_unsplash/get_app_id', 'call').then(function (appID) {
if (appID) {
var unsplash_view_url = 'https://views.unsplash.com/v';