summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-02-28 11:04:56 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-02-28 14:52:34 +0000
commit27fab2ef9dac3fe44397f404fc4c948a3a4d19ca (patch)
treec0c8ae869feda81e058f31bdf920d26bed53e8f1
parent4830a8b58cb415efc59a049ea696580f11e44728 (diff)
downloadgitlab-ce-27622-cycle-analytics-loading.tar.gz
Clone nested objects from default data.27622-cycle-analytics-loading
Checks if key is present before accessing it Fix broken test
-rw-r--r--app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es67
1 files changed, 5 insertions, 2 deletions
diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6
index 3efeb141008..7ae9de7297c 100644
--- a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6
+++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6
@@ -75,8 +75,11 @@ const DEFAULT_EVENT_OBJECTS = require('./default_event_objects');
const eventItem = Object.assign({}, DEFAULT_EVENT_OBJECTS[stage.slug], item);
eventItem.totalTime = eventItem.total_time;
- eventItem.author.webUrl = eventItem.author.web_url;
- eventItem.author.avatarUrl = eventItem.author.avatar_url;
+
+ if (eventItem.author) {
+ eventItem.author.webUrl = eventItem.author.web_url;
+ eventItem.author.avatarUrl = eventItem.author.avatar_url;
+ }
if (eventItem.created_at) eventItem.createdAt = eventItem.created_at;
if (eventItem.short_sha) eventItem.shortSha = eventItem.short_sha;