#757: revert changes in #can_publish? method

This commit is contained in:
Vokhmin Alexey V 2013-02-22 18:29:22 +04:00
parent 6a0d4b23e6
commit ff522d9ef4
3 changed files with 11 additions and 8 deletions

View File

@ -85,6 +85,10 @@ module BuildListsHelper
p.html_safe
end
def can_publish_in_future?(bl)
[BuildList::SUCCESS, BuildList::FAILED_PUBLISH, BuildList::BUILD_PUBLISHED, BuildList::TESTS_FAILED].include?(bl.status)
end
def log_reload_time_options
t = I18n.t("layout.build_lists.log.reload_times").map { |i| i.reverse }

View File

@ -282,9 +282,8 @@ class BuildList < ActiveRecord::Base
build_started? || build_pending?
end
def can_publish?(check_only_status = false)
by_status = [SUCCESS, FAILED_PUBLISH, BUILD_PUBLISHED, TESTS_FAILED].include?(status)
check_only_status ? by_status : (by_status && extra_build_lists_published?)
def can_publish?
[SUCCESS, FAILED_PUBLISH, BUILD_PUBLISHED, TESTS_FAILED].include?(status) && extra_build_lists_published?
end
def extra_build_lists_published?

View File

@ -151,14 +151,14 @@
- if can?(:publish, @build_list)
- if @build_list.build_published?
= submit_tag t("layout.publish_again"), :confirm => t("layout.publish_again_warning"), :name => 'publish'
- elsif @build_list.can_publish?(true)
- if !@build_list.extra_build_lists_published?
- elsif can_publish_in_future?(@build_list)
- if @build_list.extra_build_lists_published?
- confirm = @build_list.tests_failed? ? t('layout.build_lists.tests_failed') : t('layout.confirm')
= submit_tag t("layout.publish"), :confirm => confirm, :name => 'publish'
- else
.flash_notify
.alert.alert-error= t('layout.build_lists.publish_with_extra_fail')
.both
- else
- confirm = @build_list.tests_failed? ? t('layout.build_lists.tests_failed') : t('layout.confirm')
= submit_tag t("layout.publish"), :confirm => confirm, :name => 'publish'
- if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish'
- if @build_list.can_create_container? && can?(:create_container, @build_list)