Commit 8db3920c authored by Andrew8xx8's avatar Andrew8xx8

State renamed to merge_status

parent 26d4574a
...@@ -73,9 +73,9 @@ class MergeRequestsController < ProjectResourceController ...@@ -73,9 +73,9 @@ class MergeRequestsController < ProjectResourceController
if @merge_request.unchecked? if @merge_request.unchecked?
@merge_request.check_if_can_be_merged @merge_request.check_if_can_be_merged
end end
render json: {state: @merge_request.human_state} render json: {merge_status: @merge_request.human_merge_status}
rescue Gitlab::SatelliteNotExistError rescue Gitlab::SatelliteNotExistError
render json: {state: :no_satellite} render json: {merge_status: :no_satellite}
end end
def automerge def automerge
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# st_commits :text(2147483647) # st_commits :text(2147483647)
# st_diffs :text(2147483647) # st_diffs :text(2147483647)
# merged :boolean default(FALSE), not null # merged :boolean default(FALSE), not null
# state :integer default(1), not null # merge_status :integer default(1), not null
# milestone_id :integer # milestone_id :integer
# #
...@@ -51,13 +51,13 @@ class MergeRequest < ActiveRecord::Base ...@@ -51,13 +51,13 @@ class MergeRequest < ActiveRecord::Base
where("milestone_id = :milestone_id", milestone_id: milestone) where("milestone_id = :milestone_id", milestone_id: milestone)
end end
def human_state def human_merge_status
states = { merge_statuses = {
CAN_BE_MERGED => "can_be_merged", CAN_BE_MERGED => "can_be_merged",
CANNOT_BE_MERGED => "cannot_be_merged", CANNOT_BE_MERGED => "cannot_be_merged",
UNCHECKED => "unchecked" UNCHECKED => "unchecked"
} }
states[self.state] merge_statuses[self.merge_status]
end end
def validate_branches def validate_branches
...@@ -72,20 +72,20 @@ class MergeRequest < ActiveRecord::Base ...@@ -72,20 +72,20 @@ class MergeRequest < ActiveRecord::Base
end end
def unchecked? def unchecked?
state == UNCHECKED merge_status == UNCHECKED
end end
def mark_as_unchecked def mark_as_unchecked
self.state = UNCHECKED self.merge_status = UNCHECKED
self.save self.save
end end
def can_be_merged? def can_be_merged?
state == CAN_BE_MERGED merge_status == CAN_BE_MERGED
end end
def check_if_can_be_merged def check_if_can_be_merged
self.state = if Gitlab::Satellite::MergeAction.new(self.author, self).can_be_merged? self.merge_status = if Gitlab::Satellite::MergeAction.new(self.author, self).can_be_merged?
CAN_BE_MERGED CAN_BE_MERGED
else else
CANNOT_BE_MERGED CANNOT_BE_MERGED
...@@ -160,7 +160,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -160,7 +160,7 @@ class MergeRequest < ActiveRecord::Base
end end
def mark_as_unmergable def mark_as_unmergable
self.state = CANNOT_BE_MERGED self.merge_status = CANNOT_BE_MERGED
self.save self.save
end end
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
$(function(){ $(function(){
merge_request = new MergeRequest({ merge_request = new MergeRequest({
url_to_automerge_check: "#{automerge_check_project_merge_request_path(@project, @merge_request)}", url_to_automerge_check: "#{automerge_check_project_merge_request_path(@project, @merge_request)}",
check_enable: #{@merge_request.state == MergeRequest::UNCHECKED ? "true" : "false"}, check_enable: #{@merge_request.merge_status == MergeRequest::UNCHECKED ? "true" : "false"},
url_to_ci_check: "#{ci_status_project_merge_request_path(@project, @merge_request)}", url_to_ci_check: "#{ci_status_project_merge_request_path(@project, @merge_request)}",
ci_enable: #{@project.gitlab_ci? ? "true" : "false"}, ci_enable: #{@project.gitlab_ci? ? "true" : "false"},
current_state: "#{@merge_request.human_state}", current_status: "#{@merge_request.human_merge_status}",
action: "#{controller.action_name}" action: "#{controller.action_name}"
}); });
}); });
......
class RenameStateToMergeStatusInMilestone < ActiveRecord::Migration
def change
rename_column :merge_requests, :state, :merge_status
end
end
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# st_commits :text(2147483647) # st_commits :text(2147483647)
# st_diffs :text(2147483647) # st_diffs :text(2147483647)
# merged :boolean default(FALSE), not null # merged :boolean default(FALSE), not null
# state :integer default(1), not null # merge_status :integer default(1), not null
# milestone_id :integer # milestone_id :integer
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment