diff options
Diffstat (limited to 'app/assets/javascripts/boards/models/issue.js')
-rw-r--r-- | app/assets/javascripts/boards/models/issue.js | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/app/assets/javascripts/boards/models/issue.js b/app/assets/javascripts/boards/models/issue.js index 086340105b7..1cee9e5725a 100644 --- a/app/assets/javascripts/boards/models/issue.js +++ b/app/assets/javascripts/boards/models/issue.js @@ -11,11 +11,6 @@ import boardsStore from '../stores/boards_store'; class ListIssue { constructor(obj, defaultAvatar) { - this.id = obj.id; - this.iid = obj.iid; - this.title = obj.title; - this.confidential = obj.confidential; - this.dueDate = obj.due_date; this.subscribed = obj.subscribed; this.labels = []; this.assignees = []; @@ -25,6 +20,16 @@ class ListIssue { subscriptions: true, }; this.isLoading = {}; + + this.refreshData(obj, defaultAvatar); + } + + refreshData(obj, defaultAvatar) { + this.id = obj.id; + this.iid = obj.iid; + this.title = obj.title; + this.confidential = obj.confidential; + this.dueDate = obj.due_date; this.sidebarInfoEndpoint = obj.issue_sidebar_endpoint; this.referencePath = obj.reference_path; this.path = obj.real_path; @@ -42,11 +47,13 @@ class ListIssue { this.milestone_id = obj.milestone.id; } - obj.labels.forEach(label => { - this.labels.push(new ListLabel(label)); - }); + if (obj.labels) { + this.labels = obj.labels.map(label => new ListLabel(label)); + } - this.assignees = obj.assignees.map(a => new ListAssignee(a, defaultAvatar)); + if (obj.assignees) { + this.assignees = obj.assignees.map(a => new ListAssignee(a, defaultAvatar)); + } } addLabel(label) { |