Merged r7983 and r7984 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.2-stable@8000 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
63e2e52dd3
commit
fa894328bb
|
@ -43,6 +43,11 @@ class Version < ActiveRecord::Base
|
||||||
user.allowed_to?(:view_issues, self.project)
|
user.allowed_to?(:view_issues, self.project)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Version files have same visibility as project files
|
||||||
|
def attachments_visible?(*args)
|
||||||
|
project.present? && project.attachments_visible?(*args)
|
||||||
|
end
|
||||||
|
|
||||||
def start_date
|
def start_date
|
||||||
@start_date ||= fixed_issues.minimum('start_date')
|
@start_date ||= fixed_issues.minimum('start_date')
|
||||||
end
|
end
|
||||||
|
|
|
@ -102,7 +102,7 @@ attachments_009:
|
||||||
container_type: Version
|
container_type: Version
|
||||||
container_id: 1
|
container_id: 1
|
||||||
downloads: 0
|
downloads: 0
|
||||||
disk_filename: 060719210727_version_file.zip
|
disk_filename: 060719210727_archive.zip
|
||||||
digest: b91e08d0cf966d5c6ff411bd8c4cc3a2
|
digest: b91e08d0cf966d5c6ff411bd8c4cc3a2
|
||||||
id: 9
|
id: 9
|
||||||
filesize: 452
|
filesize: 452
|
||||||
|
|
|
@ -104,6 +104,12 @@ class AttachmentsControllerTest < ActionController::TestCase
|
||||||
assert_equal 'application/x-ruby', @response.content_type
|
assert_equal 'application/x-ruby', @response.content_type
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_download_version_file_with_issue_tracking_disabled
|
||||||
|
Project.find(1).disable_module! :issue_tracking
|
||||||
|
get :download, :id => 9
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
def test_download_should_assign_content_type_if_blank
|
def test_download_should_assign_content_type_if_blank
|
||||||
Attachment.find(4).update_attribute(:content_type, '')
|
Attachment.find(4).update_attribute(:content_type, '')
|
||||||
|
|
||||||
|
@ -123,6 +129,7 @@ class AttachmentsControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy_issue_attachment
|
def test_destroy_issue_attachment
|
||||||
|
set_tmp_attachments_directory
|
||||||
issue = Issue.find(3)
|
issue = Issue.find(3)
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
|
|
||||||
|
@ -139,6 +146,7 @@ class AttachmentsControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy_wiki_page_attachment
|
def test_destroy_wiki_page_attachment
|
||||||
|
set_tmp_attachments_directory
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
assert_difference 'Attachment.count', -1 do
|
assert_difference 'Attachment.count', -1 do
|
||||||
post :destroy, :id => 3
|
post :destroy, :id => 3
|
||||||
|
@ -147,6 +155,7 @@ class AttachmentsControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy_project_attachment
|
def test_destroy_project_attachment
|
||||||
|
set_tmp_attachments_directory
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
assert_difference 'Attachment.count', -1 do
|
assert_difference 'Attachment.count', -1 do
|
||||||
post :destroy, :id => 8
|
post :destroy, :id => 8
|
||||||
|
@ -155,6 +164,7 @@ class AttachmentsControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy_version_attachment
|
def test_destroy_version_attachment
|
||||||
|
set_tmp_attachments_directory
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
assert_difference 'Attachment.count', -1 do
|
assert_difference 'Attachment.count', -1 do
|
||||||
post :destroy, :id => 9
|
post :destroy, :id => 9
|
||||||
|
@ -163,8 +173,11 @@ class AttachmentsControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy_without_permission
|
def test_destroy_without_permission
|
||||||
post :destroy, :id => 3
|
set_tmp_attachments_directory
|
||||||
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdestroy%2F3'
|
assert_no_difference 'Attachment.count' do
|
||||||
|
delete :destroy, :id => 3
|
||||||
|
end
|
||||||
|
assert_response 302
|
||||||
assert Attachment.find_by_id(3)
|
assert Attachment.find_by_id(3)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue