Fix milestones disappearing when changed on MR
This commit is contained in:
parent
edfa2e3fb6
commit
c6420ce2ab
|
@ -16,10 +16,10 @@ export default class MilestoneSelect {
|
|||
typeof currentProject === 'string' ? JSON.parse(currentProject) : currentProject;
|
||||
}
|
||||
|
||||
this.init(els, options);
|
||||
MilestoneSelect.init(els, options);
|
||||
}
|
||||
|
||||
init(els, options) {
|
||||
static init(els, options) {
|
||||
let $els = $(els);
|
||||
|
||||
if (!els) {
|
||||
|
@ -224,7 +224,6 @@ export default class MilestoneSelect {
|
|||
$selectBox.hide();
|
||||
$value.css('display', '');
|
||||
if (data.milestone != null) {
|
||||
data.milestone.full_path = this.currentProject.full_path;
|
||||
data.milestone.remaining = timeFor(data.milestone.due_date);
|
||||
data.milestone.name = data.milestone.title;
|
||||
$value.html(milestoneLinkTemplate(data.milestone));
|
||||
|
|
|
@ -115,7 +115,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
|
|||
end
|
||||
|
||||
format.json do
|
||||
render json: @merge_request.to_json(include: { milestone: {}, assignee: { only: [:name, :username], methods: [:avatar_url] }, labels: { methods: :text_color } }, methods: [:task_status, :task_status_short])
|
||||
render json: serializer.represent(@merge_request, serializer: 'basic')
|
||||
end
|
||||
end
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
|
|
|
@ -5,4 +5,8 @@ class MergeRequestBasicEntity < IssuableSidebarEntity
|
|||
expose :state
|
||||
expose :source_branch_exists?, as: :source_branch_exists
|
||||
expose :rebase_in_progress?, as: :rebase_in_progress
|
||||
expose :milestone, using: API::Entities::Milestone
|
||||
expose :labels, using: LabelEntity
|
||||
expose :assignee, using: API::Entities::UserBasic
|
||||
expose :task_status, :task_status_short
|
||||
end
|
||||
|
|
|
@ -234,7 +234,7 @@ describe Projects::MergeRequestsController do
|
|||
body = JSON.parse(response.body)
|
||||
|
||||
expect(body['assignee'].keys)
|
||||
.to match_array(%w(name username avatar_url))
|
||||
.to match_array(%w(name username avatar_url id state web_url))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -14,7 +14,21 @@
|
|||
"subscribed": { "type": ["boolean", "null"] },
|
||||
"participants": { "type": "array" },
|
||||
"allow_collaboration": { "type": "boolean"},
|
||||
"allow_maintainer_to_push": { "type": "boolean"}
|
||||
"allow_maintainer_to_push": { "type": "boolean"},
|
||||
"assignee": {
|
||||
"oneOf": [
|
||||
{ "type": "null" },
|
||||
{ "$ref": "user.json" }
|
||||
]
|
||||
},
|
||||
"milestone": {
|
||||
"type": [ "object", "null" ]
|
||||
},
|
||||
"labels": {
|
||||
"type": [ "array", "null" ]
|
||||
},
|
||||
"task_status": { "type": "string" },
|
||||
"task_status_short": { "type": "string" }
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue