Disable autofetching of repository changesets if projects are closed (#13945).

Patch by Mischa The Evil.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11838 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-05-12 10:05:35 +00:00
parent 9b7d312a0e
commit 0dce4761a8
2 changed files with 26 additions and 1 deletions

View File

@ -111,7 +111,7 @@ class RepositoriesController < ApplicationController
end end
def show def show
@repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? @repository.fetch_changesets if @project.active? && Setting.autofetch_changesets? && @path.empty?
@entries = @repository.entries(@path, @rev) @entries = @repository.entries(@path, @rev)
@changeset = @repository.find_changeset_by_name(@rev) @changeset = @repository.find_changeset_by_name(@rev)

View File

@ -111,6 +111,31 @@ class RepositoriesControllerTest < ActionController::TestCase
assert_nil Repository.find_by_id(11) assert_nil Repository.find_by_id(11)
end end
def test_show_with_autofetch_changesets_enabled_should_fetch_changesets
Repository::Subversion.any_instance.expects(:fetch_changesets).once
with_settings :autofetch_changesets => '1' do
get :show, :id => 1
end
end
def test_show_with_autofetch_changesets_disabled_should_not_fetch_changesets
Repository::Subversion.any_instance.expects(:fetch_changesets).never
with_settings :autofetch_changesets => '0' do
get :show, :id => 1
end
end
def test_show_with_closed_project_should_not_fetch_changesets
Repository::Subversion.any_instance.expects(:fetch_changesets).never
Project.find(1).close
with_settings :autofetch_changesets => '1' do
get :show, :id => 1
end
end
def test_revisions def test_revisions
get :revisions, :id => 1 get :revisions, :id => 1
assert_response :success assert_response :success