diff options
Diffstat (limited to 'app/assets/javascripts/boards')
-rw-r--r-- | app/assets/javascripts/boards/models/issue.js | 31 | ||||
-rw-r--r-- | app/assets/javascripts/boards/stores/boards_store.js | 36 |
2 files changed, 37 insertions, 30 deletions
diff --git a/app/assets/javascripts/boards/models/issue.js b/app/assets/javascripts/boards/models/issue.js index 0e86359534b..4f5d583e61f 100644 --- a/app/assets/javascripts/boards/models/issue.js +++ b/app/assets/javascripts/boards/models/issue.js @@ -26,36 +26,7 @@ class ListIssue { } 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; - this.toggleSubscriptionEndpoint = obj.toggle_subscription_endpoint; - this.project_id = obj.project_id; - this.timeEstimate = obj.time_estimate; - this.assignableLabelsEndpoint = obj.assignable_labels_endpoint; - this.blocked = obj.blocked; - - if (obj.project) { - this.project = new IssueProject(obj.project); - } - - if (obj.milestone) { - this.milestone = new ListMilestone(obj.milestone); - this.milestone_id = obj.milestone.id; - } - - if (obj.labels) { - this.labels = obj.labels.map(label => new ListLabel(label)); - } - - if (obj.assignees) { - this.assignees = obj.assignees.map(a => new ListAssignee(a, defaultAvatar)); - } + boardsStore.refreshIssueData(this, obj, defaultAvatar); } addLabel(label) { diff --git a/app/assets/javascripts/boards/stores/boards_store.js b/app/assets/javascripts/boards/stores/boards_store.js index f233228614f..010eda9b6c5 100644 --- a/app/assets/javascripts/boards/stores/boards_store.js +++ b/app/assets/javascripts/boards/stores/boards_store.js @@ -12,6 +12,10 @@ import axios from '~/lib/utils/axios_utils'; import { mergeUrlParams } from '~/lib/utils/url_utility'; import eventHub from '../eventhub'; import { ListType } from '../constants'; +import IssueProject from '../models/project'; +import ListLabel from '../models/label'; +import ListAssignee from '../models/assignee'; +import ListMilestone from '../models/milestone'; const boardsStore = { disabled: false, @@ -593,6 +597,38 @@ const boardsStore = { clearMultiSelect() { this.multiSelect.list = []; }, + refreshIssueData(issue, obj, defaultAvatar) { + issue.id = obj.id; + issue.iid = obj.iid; + issue.title = obj.title; + issue.confidential = obj.confidential; + issue.dueDate = obj.due_date; + issue.sidebarInfoEndpoint = obj.issue_sidebar_endpoint; + issue.referencePath = obj.reference_path; + issue.path = obj.real_path; + issue.toggleSubscriptionEndpoint = obj.toggle_subscription_endpoint; + issue.project_id = obj.project_id; + issue.timeEstimate = obj.time_estimate; + issue.assignableLabelsEndpoint = obj.assignable_labels_endpoint; + issue.blocked = obj.blocked; + + if (obj.project) { + issue.project = new IssueProject(obj.project); + } + + if (obj.milestone) { + issue.milestone = new ListMilestone(obj.milestone); + issue.milestone_id = obj.milestone.id; + } + + if (obj.labels) { + issue.labels = obj.labels.map(label => new ListLabel(label)); + } + + if (obj.assignees) { + issue.assignees = obj.assignees.map(a => new ListAssignee(a, defaultAvatar)); + } + }, }; BoardsStoreEE.initEESpecific(boardsStore); |