#698: renamed method
This commit is contained in:
parent
8bbb82faa8
commit
5cf69bff92
|
@ -17,7 +17,7 @@ class Api::V1::AdvisoriesController < Api::V1::BaseController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@advisory = @build_list.build_and_associate_advisory(params[:advisory])
|
@advisory = @build_list.build_and_associate_advisory(params[:advisory])
|
||||||
if may_be_published? && @advisory.save && @build_list.save
|
if can_attach? && @advisory.save && @build_list.save
|
||||||
render_json_response @advisory, 'Advisory has been created successfully'
|
render_json_response @advisory, 'Advisory has been created successfully'
|
||||||
else
|
else
|
||||||
render_validation_error @advisory, error_message(@build_list, 'Advisory has not been created')
|
render_validation_error @advisory, error_message(@build_list, 'Advisory has not been created')
|
||||||
|
@ -25,7 +25,7 @@ class Api::V1::AdvisoriesController < Api::V1::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @advisory && may_be_published?
|
if @advisory && can_attach?
|
||||||
@advisory.attach_build_list(@build_list) &&
|
@advisory.attach_build_list(@build_list) &&
|
||||||
@advisory.save && @build_list.save
|
@advisory.save && @build_list.save
|
||||||
render_json_response @advisory, "Build list '#{@build_list.id}' has been attached to advisory successfully"
|
render_json_response @advisory, "Build list '#{@build_list.id}' has been attached to advisory successfully"
|
||||||
|
@ -40,7 +40,7 @@ class Api::V1::AdvisoriesController < Api::V1::BaseController
|
||||||
@build_list = BuildList.find params[:build_list_id]
|
@build_list = BuildList.find params[:build_list_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
def may_be_published?
|
def can_attach?
|
||||||
!@build_list.save_to_repository.publish_without_qa &&
|
!@build_list.save_to_repository.publish_without_qa &&
|
||||||
can?(:update, @build_list.save_to_platform) &&
|
can?(:update, @build_list.save_to_platform) &&
|
||||||
@build_list.save_to_platform.released &&
|
@build_list.save_to_platform.released &&
|
||||||
|
|
Loading…
Reference in New Issue