diff --git a/Gemfile b/Gemfile index fdf916ec9..e8da99956 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'rails', '4.0.3' +gem 'rails', '4.0.4' gem 'pg', '~> 0.17.1' gem 'schema_plus', '~> 1.4.0' @@ -13,7 +13,8 @@ gem 'omniauth-facebook' gem 'omniauth-google-oauth2' gem 'omniauth-github' # gem 'omniauth-openid', '~> 1.0.1' -gem 'cancan', '1.6.10' +# gem 'cancan', '1.6.10' +gem 'cancan', git: 'git://github.com/rosa-abf/cancan.git', tag: '1.6.10-abf' gem 'ancestry', '~> 2.0.0' gem 'paperclip', '~> 4.1.1' @@ -78,7 +79,7 @@ gem 'time_diff' gem 'sass-rails', '~> 4.0.1' gem 'coffee-rails', '~> 4.0.1' -gem 'compass-rails', '~> 1.1.2' +gem 'compass-rails', '~> 1.1.6' gem 'uglifier', '~> 2.4' gem 'therubyracer', '~> 0.12.1', platforms: [:mri, :rbx] gem 'therubyrhino', '~> 1.73.1', platforms: :jruby diff --git a/Gemfile.lock b/Gemfile.lock index 049e710bc..bb06d2df2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,6 +8,13 @@ GIT resque (> 1.25) resque-scheduler +GIT + remote: git://github.com/rosa-abf/cancan.git + revision: fe1089b70c08d3ed11bac4f8e69ecb3d1d9adc29 + tag: 1.6.10-abf + specs: + cancan (1.6.10) + GIT remote: git://github.com/rosa-abf/grack.git revision: 020be3fef3fb308b9d214252522aa5945bf6584a @@ -27,37 +34,37 @@ GEM remote: https://rubygems.org/ specs: RedCloth (4.2.9) - actionmailer (4.0.3) - actionpack (= 4.0.3) + actionmailer (4.0.4) + actionpack (= 4.0.4) mail (~> 2.5.4) - actionpack (4.0.3) - activesupport (= 4.0.3) + actionpack (4.0.4) + activesupport (= 4.0.4) builder (~> 3.1.0) erubis (~> 2.7.0) rack (~> 1.5.2) rack-test (~> 0.6.2) - activemodel (4.0.3) - activesupport (= 4.0.3) + activemodel (4.0.4) + activesupport (= 4.0.4) builder (~> 3.1.0) - activerecord (4.0.3) - activemodel (= 4.0.3) + activerecord (4.0.4) + activemodel (= 4.0.4) activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.3) + activesupport (= 4.0.4) arel (~> 4.0.0) activerecord-deprecated_finders (1.0.3) - activesupport (4.0.3) - i18n (~> 0.6, >= 0.6.4) + activesupport (4.0.4) + i18n (~> 0.6, >= 0.6.9) minitest (~> 4.2) multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) - airbrake (3.1.15) + airbrake (3.1.16) builder multi_json ancestry (2.0.0) activerecord (>= 3.0.0) angular-i18n (0.1.2) - angularjs-rails (1.2.7) + angularjs-rails (1.2.14) arel (4.0.2) atomic (1.1.15) attr_encrypted (1.3.2) @@ -77,7 +84,6 @@ GEM state_machine (~> 1.1) builder (3.1.4) callsite (0.0.11) - cancan (1.6.10) cape (1.8.0) capistrano (2.15.5) highline @@ -101,11 +107,11 @@ GEM coffee-script-source execjs coffee-script-source (1.7.0) - compass (0.12.2) + compass (0.12.3) chunky_png (~> 1.2) fssm (>= 0.2.7) - sass (~> 3.1) - compass-rails (1.1.3) + sass (= 3.2.14) + compass-rails (1.1.6) compass (>= 0.12.2) creole (0.5.0) daemons (1.1.9) @@ -163,19 +169,20 @@ GEM haml (>= 3.1, < 5.0) railties (>= 4.0.1) hashie (2.0.5) - highline (1.6.20) + highline (1.6.21) hike (1.2.3) hirb (0.7.1) i18n (0.6.9) - jbuilder (2.0.3) + jbuilder (2.0.4) activesupport (>= 3.0.0) multi_json (>= 1.2.0) jquery-migrate-rails (1.2.1) jquery-rails (2.3.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - js-routes (0.9.6) - rails (>= 3.2) + js-routes (0.9.7) + railties (>= 3.2) + sprockets-rails json (1.8.1) jwt (0.1.11) multi_json (>= 1.5) @@ -211,10 +218,10 @@ GEM mini_portile (0.5.2) minitest (4.7.5) mock_redis (0.11.0) - momentjs-rails (2.5.0) + momentjs-rails (2.5.1) railties (>= 3.1) mono_logger (1.1.0) - multi_json (1.8.4) + multi_json (1.9.0) multi_xml (0.5.5) multipart-post (2.0.0) nest (1.1.2) @@ -226,7 +233,7 @@ GEM net-ssh (2.8.0) net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) - newrelic_rpm (3.7.2.195) + newrelic_rpm (3.7.3.204) ng-rails-csrf (0.1.0) nokogiri (1.6.1) mini_portile (~> 0.5.0) @@ -267,9 +274,9 @@ GEM pg (0.17.1) polyglot (0.3.4) posix-spawn (0.3.8) - protected_attributes (1.0.5) + protected_attributes (1.0.7) activemodel (>= 4.0.1, < 5.0) - puma (2.7.1) + puma (2.8.1) rack (>= 1.1, < 2.0) pygments.rb (0.5.4) posix-spawn (~> 0.3.6) @@ -283,21 +290,21 @@ GEM rack (>= 1.0) rack-throttle (0.3.0) rack (>= 1.0.0) - rails (4.0.3) - actionmailer (= 4.0.3) - actionpack (= 4.0.3) - activerecord (= 4.0.3) - activesupport (= 4.0.3) + rails (4.0.4) + actionmailer (= 4.0.4) + actionpack (= 4.0.4) + activerecord (= 4.0.4) + activesupport (= 4.0.4) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.3) + railties (= 4.0.4) sprockets-rails (~> 2.0.0) rails3-generators (1.0.0) railties (>= 3.0.0) rails3-jquery-autocomplete (1.0.12) rails (>= 3.0) - railties (4.0.3) - actionpack (= 4.0.3) - activesupport (= 4.0.3) + railties (4.0.4) + actionpack (= 4.0.4) + activesupport (= 4.0.4) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.1.1) @@ -323,13 +330,14 @@ GEM redis-store (1.1.4) redis (>= 2.2) ref (1.0.5) - resque (1.25.1) + resque (1.25.2) mono_logger (~> 1.0) multi_json (~> 1.0) - redis-namespace (~> 1.2) + redis-namespace (~> 1.3) sinatra (>= 0.9.2) vegas (~> 0.1.2) - resque-scheduler (2.5.4) + resque-scheduler (2.5.5) + mono_logger (~> 1.0) redis (~> 3.0.4) resque (~> 1.25.1) rufus-scheduler (~> 2.0.24) @@ -340,9 +348,9 @@ GEM rest-client (1.6.7) mime-types (>= 1.16) rinku (1.7.3) - rouge (1.3.2) + rouge (1.3.3) rr (1.1.2) - rspec-core (2.14.7) + rspec-core (2.14.8) rspec-expectations (2.14.5) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.14.6) @@ -366,11 +374,12 @@ GEM sanitize (2.0.6) nokogiri (>= 1.4.4) sass (3.2.14) - sass-rails (4.0.1) + sass-rails (4.0.2) railties (>= 4.0.0, < 5.0) - sass (>= 3.1.10) + sass (~> 3.2.0) + sprockets (~> 2.8, <= 2.11.0) sprockets-rails (~> 2.0.0) - schema_plus (1.4.0) + schema_plus (1.4.1) rails (>= 3.2) valuable scrivener (0.0.3) @@ -424,17 +433,17 @@ GEM treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.38) + tzinfo (0.3.39) uglifier (2.4.0) execjs (>= 0.3.0) json (>= 1.8.0) - underscore-rails (1.5.2) + underscore-rails (1.6.0) valuable (0.9.8) vegas (0.1.11) rack (>= 1.0.0) warden (1.2.3) rack (>= 1.0) - whenever (0.9.0) + whenever (0.9.2) activesupport (>= 2.3.4) chronic (>= 0.6.3) wikicloth (0.8.1) @@ -458,13 +467,13 @@ DEPENDENCIES better_errors binding_of_caller bluepill (~> 0.0.60) - cancan (= 1.6.10) + cancan! cape capistrano capistrano_colors charlock_holmes (~> 0.6.9) coffee-rails (~> 4.0.1) - compass-rails (~> 1.1.2) + compass-rails (~> 1.1.6) creole devise (~> 3.2.3) diff-display (~> 0.0.1) @@ -504,7 +513,7 @@ DEPENDENCIES protected_attributes puma rack-throttle (~> 0.3.0) - rails (= 4.0.3) + rails (= 4.0.4) rails3-generators rails3-jquery-autocomplete (~> 1.0) rake diff --git a/app/controllers/api/v1/advisories_controller.rb b/app/controllers/api/v1/advisories_controller.rb index 23c722ccc..3fb5b0dd3 100644 --- a/app/controllers/api/v1/advisories_controller.rb +++ b/app/controllers/api/v1/advisories_controller.rb @@ -6,7 +6,7 @@ class Api::V1::AdvisoriesController < Api::V1::BaseController authorize_resource :build_list, only: [:create, :update] def index - @advisories = @advisories.scoped(include: [:platforms, :projects]). + @advisories = @advisories.includes(:platforms, :projects). paginate(paginate_params) end diff --git a/app/controllers/api/v1/build_lists_controller.rb b/app/controllers/api/v1/build_lists_controller.rb index 4394ea3d1..c2b5b209e 100644 --- a/app/controllers/api/v1/build_lists_controller.rb +++ b/app/controllers/api/v1/build_lists_controller.rb @@ -8,7 +8,7 @@ class Api::V1::BuildListsController < Api::V1::BaseController def index filter = BuildList::Filter.new(@project, current_user, current_ability, params[:filter] || {}) - @build_lists = filter.find.scoped(include: [:save_to_platform, :project, :user, :arch]) + @build_lists = filter.find.includes(:save_to_platform, :project, :user, :arch) @build_lists = @build_lists.recent.paginate(paginate_params) end diff --git a/app/models/build_list.rb b/app/models/build_list.rb index fcc73a244..67701645e 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -99,7 +99,7 @@ class BuildList < ActiveRecord::Base scope :recent, -> { order(updated_at: :desc) } scope :for_extra_build_lists, ->(ids, current_ability, save_to_platform) { - s = scoped + s = all s = s.where(id: ids).published_container.accessible_by(current_ability, :read) s = s.where(save_to_platform_id: save_to_platform.id) if save_to_platform && save_to_platform.main? s @@ -116,13 +116,13 @@ class BuildList < ActiveRecord::Base scope :scoped_to_project_version, ->(pr_version) { where(project_version: pr_version) if pr_version.present? } scope :scoped_to_is_circle, ->(is_circle) { where(is_circle: is_circle) } scope :for_creation_date_period, ->(start_date, end_date) { - s = scoped + s = all s = s.where(["#{table_name}.created_at >= ?", start_date]) if start_date s = s.where(["#{table_name}.created_at <= ?", end_date]) if end_date s } scope :for_notified_date_period, ->(start_date, end_date) { - s = scoped + s = all s = s.where("#{table_name}.updated_at >= ?", start_date) if start_date.present? s = s.where("#{table_name}.updated_at <= ?", end_date) if end_date.present? s diff --git a/app/models/build_list/item.rb b/app/models/build_list/item.rb index ca7228cd0..10149c310 100644 --- a/app/models/build_list/item.rb +++ b/app/models/build_list/item.rb @@ -20,11 +20,9 @@ class BuildList::Item < ActiveRecord::Base scope :recent, order("#{table_name}.level ASC, #{table_name}.name ASC") def self.group_by_level - items = scoped({}).recent - groups = [] current_level = -1 - items.each do |item| + all.recent.find_each do |item| groups << [] if current_level < item.level groups.last << item current_level = item.level diff --git a/app/models/group.rb b/app/models/group.rb index f6e3574fe..f507d8f7e 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -18,7 +18,7 @@ class Group < Avatar validates :uname, presence: true, uniqueness: {case_sensitive: false}, format: {with: /\A[a-z0-9_]+\z/}, reserved_name: true validate { errors.add(:uname, :taken) if User.by_uname(uname).present? } - scope :opened, -> { scoped } + scope :opened, -> { all } scope :by_owner, ->(owner) { where(owner_id: owner.id) } scope :by_admin, ->(admin) { joins(:actors).where('relations.role' => 'admin', 'relations.actor_id' => admin.id, 'relations.actor_type' => 'User') diff --git a/app/presenters/comment_presenter.rb b/app/presenters/comment_presenter.rb index 51999dc31..0db8741e4 100644 --- a/app/presenters/comment_presenter.rb +++ b/app/presenters/comment_presenter.rb @@ -62,7 +62,7 @@ class CommentPresenter < ApplicationPresenter end if controller.can? :destroy, @comment res << link_to(t('layout.delete'), path, method: "delete", - confirm: t('layout.comments.confirm_delete')).html_safe + data: { confirm: t('layout.comments.confirm_delete') }).html_safe end res end diff --git a/app/views/admin/flash_notifies/index.html.haml b/app/views/admin/flash_notifies/index.html.haml index a3d62485b..cb2d66698 100644 --- a/app/views/admin/flash_notifies/index.html.haml +++ b/app/views/admin/flash_notifies/index.html.haml @@ -15,7 +15,7 @@ %td= flash_notify.published %td = link_to t("layout.flash_notifies.edit"), edit_admin_flash_notify_path(flash_notify) - = link_to t("layout.flash_notifies.delete"), admin_flash_notify_path(flash_notify), method: :delete, confirm: t("layout.mass_builds.cancel_confirm") if can?(:delete, flash_notify) + = link_to t("layout.flash_notifies.delete"), admin_flash_notify_path(flash_notify), method: :delete, data: { confirm: t("layout.mass_builds.cancel_confirm") } if can?(:delete, flash_notify) = will_paginate @flash_notifies diff --git a/app/views/admin/users/_users_ajax.json.jbuilder b/app/views/admin/users/_users_ajax.json.jbuilder index 425d4b6de..b82fae736 100644 --- a/app/views/admin/users/_users_ajax.json.jbuilder +++ b/app/views/admin/users/_users_ajax.json.jbuilder @@ -1,8 +1,8 @@ users = @users.map do |user| link_block = [ (link_to t('layout.edit'), edit_admin_user_path(user) if can?(:edit, user) && !@system_list), - (link_to t('layout.users.reset_token'), reset_auth_token_admin_user_path(user), method: :put, confirm: t('layout.users.confirm_reset_token') if can?(:edit, user) && @system_list), - (link_to t('layout.delete'), admin_user_path(user), method: :delete, confirm: t('layout.users.confirm_delete') if can? :destroy, user) + (link_to t('layout.users.reset_token'), reset_auth_token_admin_user_path(user), method: :put, data: { confirm: t('layout.users.confirm_reset_token') } if can?(:edit, user) && @system_list), + (link_to t('layout.delete'), admin_user_path(user), method: :delete, data: { confirm: t('layout.users.confirm_delete') } if can? :destroy, user) ].compact.join(' | ').html_safe if !@system_list diff --git a/app/views/groups/profile/edit.html.haml b/app/views/groups/profile/edit.html.haml index 077b4dbee..f8aaa8c5e 100644 --- a/app/views/groups/profile/edit.html.haml +++ b/app/views/groups/profile/edit.html.haml @@ -9,7 +9,7 @@ .hr .leftside= t("layout.groups.delete_warning") .rightside - = link_to t("layout.delete"), profile_group_path(@group), method: :delete, confirm: t("layout.groups.confirm_delete"), class: 'button' if can? :destroy, @group + = link_to t("layout.delete"), profile_group_path(@group), method: :delete, data: { confirm: t("layout.groups.confirm_delete") }, class: 'button' if can? :destroy, @group .both - content_for :sidebar, render('sidebar') diff --git a/app/views/platforms/key_pairs/_list.html.haml b/app/views/platforms/key_pairs/_list.html.haml index 540515841..2af0722fb 100644 --- a/app/views/platforms/key_pairs/_list.html.haml +++ b/app/views/platforms/key_pairs/_list.html.haml @@ -14,5 +14,5 @@ %td= link_to repository.key_pair.user.fullname, user_path(repository.key_pair.user) %td.buttons - if can? :destroy, repository.key_pair - = link_to platform_key_pair_path(@platform, repository.key_pair), method: :delete, confirm: t("layout.key_pairs.confirm_delete") do + = link_to platform_key_pair_path(@platform, repository.key_pair), method: :delete, data: { confirm: t("layout.key_pairs.confirm_delete") } do %span.delete   diff --git a/app/views/platforms/mass_builds/index.html.haml b/app/views/platforms/mass_builds/index.html.haml index 00498b6c6..f7416cc25 100644 --- a/app/views/platforms/mass_builds/index.html.haml +++ b/app/views/platforms/mass_builds/index.html.haml @@ -39,15 +39,15 @@ - unless mass_build.auto_publish? = link_to t('layout.mass_builds.publish_success'), publish_platform_mass_build_path(@platform, mass_build.id), - method: :post, confirm: t("layout.confirm"), class: 'button' + method: :post, data: confirm: t("layout.confirm") }, class: 'button' = link_to t('layout.mass_builds.publish_test_failed'), publish_platform_mass_build_path(@platform, mass_build.id, status: 'test_failed'), - method: :post, confirm: t("layout.confirm"), class: 'button' + method: :post, data: { confirm: t("layout.confirm") }, class: 'button' - if can?(:cancel, mass_build) = link_to t('layout.cancel'), cancel_platform_mass_build_path(@platform, mass_build.id), method: :post, class: 'button', - confirm: t('layout.mass_builds.cancel_confirm') + data: { confirm: t('layout.mass_builds.cancel_confirm') } %td %a.toggle_btn{href: "#toggle_#{ mass_build.id }", :'data-target' => "#toggle_#{ mass_build.id }"}= t("layout.mass_builds.extended_data") .toggle{id: "toggle_#{ mass_build.id }"} diff --git a/app/views/platforms/platforms/edit.html.haml b/app/views/platforms/platforms/edit.html.haml index 2e12dedd2..4acd59c65 100644 --- a/app/views/platforms/platforms/edit.html.haml +++ b/app/views/platforms/platforms/edit.html.haml @@ -11,7 +11,7 @@ .rightside= link_to t("layout.platforms.change_visibility_from_#{@platform.visibility}"), change_visibility_platform_path(@platform), method: :post, - confirm: t("layout.platforms.confirm_change_visibility"), + data: { confirm: t("layout.platforms.confirm_change_visibility") }, class: 'button' .both @@ -41,15 +41,15 @@ .both .leftside - .rightside= link_to t('layout.regeneration_statuses.regenerate_metadata'), regenerate_metadata_platform_path(@platform), method: :put, confirm: t('layout.confirm'), class: 'button' + .rightside= link_to t('layout.regeneration_statuses.regenerate_metadata'), regenerate_metadata_platform_path(@platform), method: :put, data: { confirm: t('layout.confirm') }, class: 'button' .both - if can? :destroy, @platform .hr .leftside= t("layout.platforms.delete_warning") - .rightside= link_to t("layout.delete"), platform_path(@platform), method: :delete, confirm: t("layout.platforms.confirm_delete"), class: 'button' + .rightside= link_to t("layout.delete"), platform_path(@platform), method: :delete, data: { confirm: t("layout.platforms.confirm_delete") }, class: 'button' - if can? :clear, @platform .hr .leftside= t("layout.repositories.clear_warning") - .rightside= link_to t("layout.repositories.clear"), clear_platform_path(@platform), class: 'button', confirm: t('layout.repositories.clear_confirm'), method: :put + .rightside= link_to t("layout.repositories.clear"), clear_platform_path(@platform), class: 'button', data: { confirm: t('layout.repositories.clear_confirm') }, method: :put .both diff --git a/app/views/platforms/product_build_lists/_product_build_list.html.haml b/app/views/platforms/product_build_lists/_product_build_list.html.haml index 0f8dcda0d..a1a073cbe 100644 --- a/app/views/platforms/product_build_lists/_product_build_list.html.haml +++ b/app/views/platforms/product_build_lists/_product_build_list.html.haml @@ -9,5 +9,5 @@ %td= pbl.human_status %td= link_to(nil, pbl.container_path) unless pbl.project %td= link_to pbl.product.name, platform_product_path(platform, product) - %td= link_to image_tag('x.png'), platform_product_product_build_list_path(platform, product, pbl), method: :delete, confirm: t("layout.confirm") if can?(:destroy, pbl) && pbl.can_destroy? && !pbl.project + %td= link_to image_tag('x.png'), platform_product_product_build_list_path(platform, product, pbl), method: :delete, data: { confirm: t("layout.confirm") } if can?(:destroy, pbl) && pbl.can_destroy? && !pbl.project = datetime_moment pbl.updated_at, tag: :td \ No newline at end of file diff --git a/app/views/platforms/product_build_lists/show.html.haml b/app/views/platforms/product_build_lists/show.html.haml index 415d25c8a..ba72e27d1 100644 --- a/app/views/platforms/product_build_lists/show.html.haml +++ b/app/views/platforms/product_build_lists/show.html.haml @@ -32,7 +32,7 @@ - if can?(:cancel, pbl) = link_to t("layout.build_lists.cancel"), cancel_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl), - method: :put, confirm: t("layout.confirm"), class: 'button', + method: :put, data: { confirm: t("layout.confirm") }, class: 'button', 'ng-show' => 'pbl.can_cancel' .both %br diff --git a/app/views/platforms/products/_list.html.haml b/app/views/platforms/products/_list.html.haml index 3b74dcf8e..deb8c4147 100644 --- a/app/views/platforms/products/_list.html.haml +++ b/app/views/platforms/products/_list.html.haml @@ -10,5 +10,5 @@ = link_to product.name, platform_product_path(@platform, product) %td.buttons - if can? :destroy, product - = link_to platform_product_path(@platform, product), method: :delete, confirm: t("layout.products.confirm_delete") do + = link_to platform_product_path(@platform, product), method: :delete, data: { confirm: t("layout.products.confirm_delete") } do %span.delete   diff --git a/app/views/platforms/products/show.html.haml b/app/views/platforms/products/show.html.haml index 8a3593ba8..08a2e041a 100644 --- a/app/views/platforms/products/show.html.haml +++ b/app/views/platforms/products/show.html.haml @@ -10,7 +10,7 @@ - if can? :update, @product = link_to image_tag("code.png", alt: t("layout.edit")) + " " + t("layout.edit"), edit_platform_product_path(@platform, @product), class: "button" - if can? :destroy, @product - = link_to image_tag("x.png", alt: t("layout.delete")) + " " + t("layout.delete"), platform_product_path(@platform, @product), method: "delete", class: "button", confirm: t("layout.products.confirm_delete") + = link_to image_tag("x.png", alt: t("layout.delete")) + " " + t("layout.delete"), platform_product_path(@platform, @product), method: "delete", class: "button", data: { confirm: t("layout.products.confirm_delete") } - if can?(:create, @product.product_build_lists.build) = link_to t("layout.products.build"), new_platform_product_product_build_list_path(@platform, @product), class: "button" diff --git a/app/views/platforms/repositories/_project.json.jbuilder b/app/views/platforms/repositories/_project.json.jbuilder index 70d91cd55..155f72ade 100644 --- a/app/views/platforms/repositories/_project.json.jbuilder +++ b/app/views/platforms/repositories/_project.json.jbuilder @@ -8,7 +8,7 @@ if can? :remove_project, @repository link_to( remove_project_platform_repository_path(@platform, @repository, project_id: pr.id), - method: :delete, confirm: t("layout.confirm")) do + method: :delete, data: { confirm: t("layout.confirm") }) do content_tag(:span, " ".html_safe, class: 'delete') end else diff --git a/app/views/platforms/repositories/edit.html.haml b/app/views/platforms/repositories/edit.html.haml index af9dea764..c2fb4a36d 100644 --- a/app/views/platforms/repositories/edit.html.haml +++ b/app/views/platforms/repositories/edit.html.haml @@ -16,7 +16,7 @@ .leftlist= t('layout.repositories.regenerate_metadata') .rightlist = select_tag :build_for_platform_id, options_from_collection_for_select(Platform.main, :id, :name) if @platform.personal? - = f.submit t('layout.repositories.regenerate_metadata'), confirm: t('layout.confirm') + = f.submit t('layout.repositories.regenerate_metadata'), data: { confirm: t('layout.confirm') } .both - if @repository.repository_statuses.present? @@ -49,7 +49,7 @@ - path = sync_lock_file_platform_repository_path(@platform, @repository) = form_for @repository, url: path, html: { class: :form, method: :put } do |f| .leftlist= t('layout.repositories.sync_lock_file_info') - .rightlist= f.submit label, confirm: t('layout.confirm') + .rightlist= f.submit label, data: { confirm: t('layout.confirm') } .both .hr diff --git a/app/views/platforms/repositories/show.html.haml b/app/views/platforms/repositories/show.html.haml index c23beb6a9..98617cb97 100644 --- a/app/views/platforms/repositories/show.html.haml +++ b/app/views/platforms/repositories/show.html.haml @@ -10,7 +10,7 @@ - if can? :update, @repository = link_to image_tag("code.png", alt: t("layout.edit")) + " " + t("layout.edit"), edit_platform_repository_path(@platform, @repository), class: "button" - if can? :destroy, @repository - = link_to image_tag("x.png", alt: t("layout.delete")) + " " + t("layout.delete"), platform_repository_path(@platform, @repository), method: "delete", class: "button", confirm: t("layout.repositories.confirm_delete") + = link_to image_tag("x.png", alt: t("layout.delete")) + " " + t("layout.delete"), platform_repository_path(@platform, @repository), method: "delete", class: "button", data: { confirm: t("layout.repositories.confirm_delete") } %br %br %h3.fix= t("layout.projects.list_header") diff --git a/app/views/platforms/tokens/show.html.haml b/app/views/platforms/tokens/show.html.haml index b90277aaf..a0263dc3a 100644 --- a/app/views/platforms/tokens/show.html.haml +++ b/app/views/platforms/tokens/show.html.haml @@ -38,4 +38,4 @@ = link_to t('layout.tokens.withdraw'), withdraw_platform_token_path(@platform, @token), method: :post, class: 'button', - confirm: t('layout.tokens.withdraw_confirm') + data: { confirm: t('layout.tokens.withdraw_confirm') } diff --git a/app/views/projects/build_lists/show.html.haml b/app/views/projects/build_lists/show.html.haml index 23173d522..4215b6d25 100644 --- a/app/views/projects/build_lists/show.html.haml +++ b/app/views/projects/build_lists/show.html.haml @@ -172,31 +172,31 @@ - if can?(:cancel, @build_list) = link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list), - method: :put, confirm: t("layout.confirm"), class: 'button', + method: :put, data: { confirm: t("layout.confirm") }, class: 'button', 'ng-show' => 'build_list.can_cancel' = submit_tag t('layout.publish_again'), - confirm: t("layout.publish_again_warning"), + data: { confirm: t("layout.publish_again_warning") }, name: 'publish', 'ng-show' => "build_list.can_publish && build_list.status == #{BuildList::BUILD_PUBLISHED}" = submit_tag t("layout.publish"), - confirm: t('layout.build_lists.tests_failed'), name: 'publish', + data: { confirm: t('layout.build_lists.tests_failed') }, name: 'publish', 'ng-show' => "build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status == #{BuildList::TESTS_FAILED}" = submit_tag t("layout.publish"), - confirm: t('layout.confirm'), name: 'publish', + data: { confirm: t('layout.confirm') }, name: 'publish', 'ng-show' => "build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status != #{BuildList::TESTS_FAILED} && build_list.status != #{BuildList::BUILD_PUBLISHED}" = link_to t('layout.publish_into_testing'), publish_into_testing_build_list_path(@build_list), - method: :put, confirm: t("layout.confirm"), + method: :put, data: { confirm: t("layout.confirm") }, class: 'button', 'ng-show' => 'build_list.can_publish_into_testing' - if can?(:reject_publish, @build_list) = link_to t('layout.reject_publish'), reject_publish_build_list_path(@build_list), - method: :put, confirm: t("layout.confirm"), + method: :put, data: { confirm: t("layout.confirm") }, class: 'button', 'ng-show' => 'build_list.can_reject_publish' - if can?(:create_container, @build_list) = link_to t("layout.build_lists.create_container"), create_container_build_list_path(@build_list), - method: :put, confirm: t("layout.confirm"), + method: :put, data: { confirm: t("layout.confirm") }, class: 'button', 'ng-show' => 'build_list.can_create_container' - if can? :create, @build_list diff --git a/app/views/projects/hooks/show.html.haml b/app/views/projects/hooks/show.html.haml index e4c534ad1..35065cb17 100644 --- a/app/views/projects/hooks/show.html.haml +++ b/app/views/projects/hooks/show.html.haml @@ -22,5 +22,5 @@ .leftlist .rightlist = link_to t('layout.edit'), edit_project_hook_path(@project, hook), class: 'button' - = link_to t('layout.delete'), project_hook_path(@project, hook), method: :delete, confirm: t('layout.confirm'), class: 'button' + = link_to t('layout.delete'), project_hook_path(@project, hook), method: :delete, data: { confirm: t('layout.confirm') }, class: 'button' .hr diff --git a/app/views/projects/projects/_project.html.haml b/app/views/projects/projects/_project.html.haml index f7433fb9e..534268349 100644 --- a/app/views/projects/projects/_project.html.haml +++ b/app/views/projects/projects/_project.html.haml @@ -11,5 +11,5 @@ = t("layout.collaborators.role_names.#{current_user.best_role project}") %td.td5 - unless project.owner == current_user or !alone_member - = link_to remove_user_project_path(project), method: :delete, confirm: t("layout.confirm") do + = link_to remove_user_project_path(project), method: :delete, data: { confirm: t("layout.confirm") } do %span.delete   diff --git a/app/views/projects/projects/edit.html.haml b/app/views/projects/projects/edit.html.haml index f9f023461..9c77a9960 100644 --- a/app/views/projects/projects/edit.html.haml +++ b/app/views/projects/projects/edit.html.haml @@ -33,6 +33,6 @@ .hr .leftside= t("layout.projects.delete_warning") -.rightside= link_to t("layout.delete"), project_path(@project), method: :delete, confirm: t("layout.projects.confirm_delete"), class: 'button' if can? :destroy, @project +.rightside= link_to t("layout.delete"), project_path(@project), method: :delete, data: { confirm: t("layout.projects.confirm_delete") }, class: 'button' if can? :destroy, @project .both diff --git a/app/views/projects/wiki/_page.html.haml b/app/views/projects/wiki/_page.html.haml index e1e8432c0..f8a6efd76 100644 --- a/app/views/projects/wiki/_page.html.haml +++ b/app/views/projects/wiki/_page.html.haml @@ -15,5 +15,5 @@ = datetime_moment date, tag: :span - unless action_name == 'preview' or cannot? :write, @project %p#delete-link - = link_to project_wiki_path(@project, escaped_name), method: :delete, confirm: t("layout.confirm") do + = link_to project_wiki_path(@project, escaped_name), method: :delete, data: { confirm: t("layout.confirm") } do %span= t("wiki.delete_page") \ No newline at end of file diff --git a/app/views/shared/_members_table.html.haml b/app/views/shared/_members_table.html.haml index 13939a297..6d2fc7684 100644 --- a/app/views/shared/_members_table.html.haml +++ b/app/views/shared/_members_table.html.haml @@ -23,7 +23,7 @@ .forimg= link_to user.fullname, user_path(user) - if can? :remove_member, editable_object %td.buttons - = link_to "#{remove_member_path}?member_id=#{user.id}", method: :delete, confirm: t("layout.confirm") do + = link_to "#{remove_member_path}?member_id=#{user.id}", method: :delete, data: { confirm: t("layout.confirm") } do %span.delete   - if can? :remove_members, editable_object = submit_tag t("layout.delete"), class: 'button', data: {'disable-with' => t('layout.processing')} diff --git a/app/views/users/ssh_keys/index.html.haml b/app/views/users/ssh_keys/index.html.haml index e26e114c0..ba9d4783a 100644 --- a/app/views/users/ssh_keys/index.html.haml +++ b/app/views/users/ssh_keys/index.html.haml @@ -9,7 +9,7 @@ - @ssh_keys.each do |key| %tr %td="#{key.name} (#{key.fingerprint})" - %td= link_to image_tag('x.png'), ssh_key_path(key), method: :delete, confirm: t('layout.confirm') + %td= link_to image_tag('x.png'), ssh_key_path(key), method: :delete, data: { confirm: t('layout.confirm') } .both %h3.fix.bpadding10= t 'add_key' diff --git a/lib/abf_worker/build_lists_publish_task_manager.rb b/lib/abf_worker/build_lists_publish_task_manager.rb index 9e0731680..21884f005 100644 --- a/lib/abf_worker/build_lists_publish_task_manager.rb +++ b/lib/abf_worker/build_lists_publish_task_manager.rb @@ -209,7 +209,7 @@ module AbfWorker select('MIN(updated_at) as min_updated_at, save_to_repository_id, build_for_platform_id'). where(new_core: true, status: (testing ? BuildList::BUILD_PUBLISH_INTO_TESTING : BuildList::BUILD_PUBLISH)). group(:save_to_repository_id, :build_for_platform_id). - order(:min_updated_at). + order('min_updated_at ASC'). limit(@workers_count * 2) # because some repos may be locked locked_rep = RepositoryStatus.not_ready.joins(:platform). @@ -289,7 +289,7 @@ module AbfWorker # Checks mirror sync status return false if save_to_repository.repo_lock_file_exists? || !save_to_repository.platform.ready? - repository_status = save_to_repository.repository_statuses.find_or_create_by_platform_id(build_for_platform_id) + repository_status = save_to_repository.repository_statuses.find_or_create_by(platform_id: build_for_platform_id) return false unless repository_status.publish save_to_platform = save_to_repository.platform