#53: set publisher on MassBuilds#publish action
This commit is contained in:
parent
c9b04a6acc
commit
c5c54013f3
|
@ -29,9 +29,9 @@ class Platforms::MassBuildsController < Platforms::BaseController
|
|||
|
||||
def publish
|
||||
if params[:status] == 'test_failed'
|
||||
@mass_build.publish_test_faild_builds
|
||||
@mass_build.publish_test_faild_builds current_user
|
||||
else
|
||||
@mass_build.publish_success_builds
|
||||
@mass_build.publish_success_builds current_user
|
||||
end
|
||||
redirect_to(platform_mass_builds_path(@mass_build.platform), :notice => t("flash.platform.publish_success"))
|
||||
end
|
||||
|
|
|
@ -77,20 +77,22 @@ class MassBuild < ActiveRecord::Base
|
|||
end
|
||||
later :cancel_all, :queue => :clone_build
|
||||
|
||||
def publish_success_builds
|
||||
publish BuildList::SUCCESS, BuildList::FAILED_PUBLISH
|
||||
def publish_success_builds(user)
|
||||
publish user, BuildList::SUCCESS, BuildList::FAILED_PUBLISH
|
||||
end
|
||||
later :publish_success_builds, :queue => :clone_build
|
||||
|
||||
def publish_test_faild_builds
|
||||
publish BuildList::TESTS_FAILED
|
||||
def publish_test_faild_builds(user)
|
||||
publish user, BuildList::TESTS_FAILED
|
||||
end
|
||||
later :publish_test_faild_builds, :queue => :clone_build
|
||||
|
||||
private
|
||||
|
||||
def publish(*statuses)
|
||||
build_lists.where(:status => statuses).order(:id).find_in_batches(:batch_size => 50) do |bls|
|
||||
def publish(user, *statuses)
|
||||
builds = build_lists.where(:status => statuses)
|
||||
builds.update_all(:publisher_id => user.id)
|
||||
builds.order(:id).find_in_batches(:batch_size => 50) do |bls|
|
||||
bls.each{ |bl| bl.can_publish? && bl.now_publish }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue