From 8ebfd1cb1e48a4f62798c3f7bf64cff488adc607 Mon Sep 17 00:00:00 2001 From: Mateusz Rybarski Date: Tue, 21 Nov 2017 10:43:13 +0100 Subject: [PATCH 1/4] missing import 'fetch' from 'fetch' --- app/components/recirculation-prefooter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/components/recirculation-prefooter.js b/app/components/recirculation-prefooter.js index 040e9b32ef6..f782842544d 100644 --- a/app/components/recirculation-prefooter.js +++ b/app/components/recirculation-prefooter.js @@ -1,3 +1,4 @@ +import fetch from 'fetch'; import {inject as service} from '@ember/service'; import Component from '@ember/component'; import {computed} from '@ember/object'; From f0b81f12590098e05403f5b584b89bde57978ee7 Mon Sep 17 00:00:00 2001 From: Mateusz Rybarski Date: Tue, 21 Nov 2017 10:44:19 +0100 Subject: [PATCH 2/4] missing Promise import --- app/mixins/image-loader.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/mixins/image-loader.js b/app/mixins/image-loader.js index 6ba05c20f01..9f716748018 100644 --- a/app/mixins/image-loader.js +++ b/app/mixins/image-loader.js @@ -1,4 +1,5 @@ import Mixin from '@ember/object/mixin'; +import {Promise} from 'rsvp'; export default Mixin.create({ /** From 616f84a02d292534f8593b62ff54a61b2f42d416 Mon Sep 17 00:00:00 2001 From: Mateusz Rybarski Date: Tue, 21 Nov 2017 10:49:13 +0100 Subject: [PATCH 3/4] do not use JSON.parse for undefined --- app/models/wikia-in-your-lang.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/wikia-in-your-lang.js b/app/models/wikia-in-your-lang.js index dbed657c9ba..6328bbfba76 100644 --- a/app/models/wikia-in-your-lang.js +++ b/app/models/wikia-in-your-lang.js @@ -20,7 +20,8 @@ function getCacheKey(lang) { */ function getFromCache(browserLang) { const key = getCacheKey(browserLang), - value = JSON.parse(localStorageConnector.getItem(key)), + valueJson = localStorageConnector.getItem(key) || '{}', + value = JSON.parse(valueJson), now = new Date().getTime(); // we cache for 30 days (2592000000) From a3b50b028ac1fbe731f30cea57786f85aef214c2 Mon Sep 17 00:00:00 2001 From: Mateusz Rybarski Date: Tue, 21 Nov 2017 10:57:19 +0100 Subject: [PATCH 4/4] do not use JSON.parse for undefined --- app/models/wikia-in-your-lang.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/wikia-in-your-lang.js b/app/models/wikia-in-your-lang.js index 6328bbfba76..0ee150e3795 100644 --- a/app/models/wikia-in-your-lang.js +++ b/app/models/wikia-in-your-lang.js @@ -25,7 +25,7 @@ function getFromCache(browserLang) { now = new Date().getTime(); // we cache for 30 days (2592000000) - if (!value || now - value.timestamp > 2592000000) { + if (!value.model || now - value.timestamp > 2592000000) { return null; }