diff --git a/app/assets/javascripts/extra/build_list.js b/app/assets/javascripts/extra/build_list.js index 99241e9cf..26eaad39c 100644 --- a/app/assets/javascripts/extra/build_list.js +++ b/app/assets/javascripts/extra/build_list.js @@ -9,9 +9,13 @@ $(document).ready(function() { var build_platform = $('#build_for_pl_' + platform_id); var all_repositories = $('.all_platforms input'); all_repositories.removeAttr('checked'); + + var new_core = $('#build_list_new_core'); if (build_platform.size() == 0) { all_repositories.removeAttr('disabled'); + new_core.removeAttr('disabled').attr('checked', 'checked'); } else { + new_core.removeAttr('checked').attr('disabled', 'disabled'); all_repositories.attr('disabled', 'disabled'); var parent = build_platform.parent(); parent.find('input').removeAttr('disabled'); diff --git a/app/controllers/api/v1/build_lists_controller.rb b/app/controllers/api/v1/build_lists_controller.rb index 6d9889357..dd0fea821 100644 --- a/app/controllers/api/v1/build_lists_controller.rb +++ b/app/controllers/api/v1/build_lists_controller.rb @@ -26,7 +26,7 @@ class Api::V1::BuildListsController < Api::V1::BaseController @build_list.user = current_user @build_list.priority = current_user.build_priority # User builds more priority than mass rebuild with zero priority - @build_list.new_core = BuildList.has_access_to_new_core?(current_user) && bl_params[:new_core] == '1' + @build_list.new_core = save_to_repository.platform.personal? && bl_params[:new_core] == '1' if @build_list.save render :action => 'show' diff --git a/app/controllers/projects/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb index a53adc333..33560307a 100644 --- a/app/controllers/projects/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -55,7 +55,7 @@ class Projects::BuildListsController < Projects::BaseController build_for_platforms = Repository.select(:platform_id). where(:id => params[:build_list][:include_repos]).group(:platform_id).map(&:platform_id) - new_core = BuildList.has_access_to_new_core?(current_user) && params[:build_list][:new_core] == '1' + new_core = @platform.personal? && params[:build_list][:new_core] == '1' Arch.where(:id => params[:arches]).each do |arch| Platform.main.where(:id => build_for_platforms).each do |build_for_platform| @build_list = @project.build_lists.build(params[:build_list]) diff --git a/app/models/build_list.rb b/app/models/build_list.rb index f35669a13..530aa4af9 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -337,10 +337,6 @@ class BuildList < ActiveRecord::Base @status end - def self.has_access_to_new_core?(user) - user && (user.admin? || user.tester?) - end - def self.human_status(status) I18n.t("layout.build_lists.statuses.#{HUMAN_STATUSES[status]}") end diff --git a/app/views/projects/build_lists/new.html.haml b/app/views/projects/build_lists/new.html.haml index 86e077fa9..1abd63f5a 100644 --- a/app/views/projects/build_lists/new.html.haml +++ b/app/views/projects/build_lists/new.html.haml @@ -29,10 +29,9 @@ .both = f.check_box :build_requires = f.label :build_requires - - if BuildList.has_access_to_new_core?(current_user) - .both - = f.check_box :new_core - = f.label :new_core + .both + = f.check_box :new_core + = f.label :new_core %br = f.submit t("layout.projects.build_button")