diff options
author | Phil Hughes <me@iamphill.com> | 2017-09-29 14:49:14 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-09-29 14:49:14 +0300 |
commit | 775c9f68708a1a7290f5a950da9a953908645a65 (patch) | |
tree | f8aef012b99ab190b7e24edeca65614655bc19a6 /app/assets/javascripts/vue_merge_request_widget | |
parent | e178eb782a1a5ac24c18ed4e4a1c1d55bee8251f (diff) |
fixed specs when merged event was empty
Diffstat (limited to 'app/assets/javascripts/vue_merge_request_widget')
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js b/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js index 5bd3af3bd8d..2f1c0a4c654 100644 --- a/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js +++ b/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js @@ -117,11 +117,9 @@ export default class MergeRequestStore { } static getEventObject(event) { - if (!event) return null; - return { author: MergeRequestStore.getAuthorObject(event), - updatedAt: gl.utils.formatDate(event.updated_at), + updatedAt: gl.utils.formatDate(MergeRequestStore.getEventUpdatedAtDate(event)), formattedUpdatedAt: MergeRequestStore.getEventDate(event), }; } @@ -139,6 +137,14 @@ export default class MergeRequestStore { }; } + static getEventUpdatedAtDate(event) { + if (!event) { + return ''; + } + + return event.updated_at; + } + static getEventDate(event) { const timeagoInstance = new Timeago(); @@ -146,7 +152,7 @@ export default class MergeRequestStore { return ''; } - return timeagoInstance.format(event.updated_at); + return timeagoInstance.format(MergeRequestStore.getEventUpdatedAtDate(event)); } } |