Browse Source

Remove deprecated WikiContent::Version (#35031).


git-svn-id: http://svn.redmine.org/redmine/trunk@21002 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/5.0.0
Go MAEDA 3 years ago
parent
commit
ec3527102d

+ 2
- 2
app/helpers/application_helper.rb View File

@@ -976,7 +976,7 @@ module ApplicationHelper
wiki_page = link_project.wiki.find_page(page)
url =
if anchor.present? && wiki_page.present? &&
(obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)) &&
(obj.is_a?(WikiContent) || obj.is_a?(WikiContentVersion)) &&
obj.page == wiki_page
"##{anchor}"
else
@@ -1330,7 +1330,7 @@ module ApplicationHelper
anchor = sanitize_anchor_name(item)
# used for single-file wiki export
if options[:wiki_links] == :anchor && (obj.is_a?(WikiContent) ||
obj.is_a?(WikiContent::Version))
obj.is_a?(WikiContentVersion))
anchor = "#{obj.page.title}_#{anchor}"
end
@heading_anchors[anchor] ||= 0

+ 1
- 1
app/models/user.rb View File

@@ -948,7 +948,7 @@ class User < Principal
Token.where('user_id = ?', id).delete_all
Watcher.where('user_id = ?', id).delete_all
WikiContent.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
WikiContent::Version.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
WikiContentVersion.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
end

# Singleton class method is public

+ 0
- 4
app/models/wiki_content.rb View File

@@ -98,8 +98,4 @@ class WikiContent < ActiveRecord::Base
Mailer.deliver_wiki_content_updated(self)
end
end

# For backward compatibility
# TODO: remove it in Redmine 5
Version = WikiContentVersion
end

+ 1
- 1
lib/redmine.rb View File

@@ -420,7 +420,7 @@ Redmine::Activity.map do |activity|
activity.register :news
activity.register :documents, :class_name => %w(Document Attachment)
activity.register :files, :class_name => 'Attachment'
activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false
activity.register :wiki_edits, :class_name => 'WikiContentVersion', :default => false
activity.register :messages, :default => false
activity.register :time_entries, :default => false
end

+ 1
- 1
lib/redmine/wiki_formatting/macros.rb View File

@@ -202,7 +202,7 @@ module Redmine
page = nil
if args.size > 0
page = Wiki.find_page(args.first.to_s, :project => @project)
elsif obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)
elsif obj.is_a?(WikiContent) || obj.is_a?(WikiContentVersion)
page = obj.page
else
raise t(:error_childpages_macro_no_argument)

+ 6
- 6
test/integration/api_test/wiki_pages_test.rb View File

@@ -104,7 +104,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base

test "PUT /projects/:project_id/wiki/:title.xml should update wiki page" do
assert_no_difference 'WikiPage.count' do
assert_difference 'WikiContent::Version.count' do
assert_difference 'WikiContentVersion.count' do
put(
'/projects/ecookbook/wiki/CookBook_documentation.xml',
:params => {
@@ -128,7 +128,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base

test "PUT /projects/:project_id/wiki/:title.xml with current versino should update wiki page" do
assert_no_difference 'WikiPage.count' do
assert_difference 'WikiContent::Version.count' do
assert_difference 'WikiContentVersion.count' do
put(
'/projects/ecookbook/wiki/CookBook_documentation.xml',
:params => {
@@ -153,7 +153,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base

test "PUT /projects/:project_id/wiki/:title.xml with stale version should respond with 409" do
assert_no_difference 'WikiPage.count' do
assert_no_difference 'WikiContent::Version.count' do
assert_no_difference 'WikiContentVersion.count' do
put(
'/projects/ecookbook/wiki/CookBook_documentation.xml',
:params => {
@@ -172,7 +172,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base

test "PUT /projects/:project_id/wiki/:title.xml should create the page if it does not exist" do
assert_difference 'WikiPage.count' do
assert_difference 'WikiContent::Version.count' do
assert_difference 'WikiContentVersion.count' do
put(
'/projects/ecookbook/wiki/New_page_from_API.xml',
:params => {
@@ -200,7 +200,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base
set_tmp_attachments_directory
attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2)
assert_difference 'WikiPage.count' do
assert_difference 'WikiContent::Version.count' do
assert_difference 'WikiContentVersion.count' do
put(
'/projects/ecookbook/wiki/New_page_from_API.xml',
:params => {
@@ -228,7 +228,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base

test "PUT /projects/:project_id/wiki/:title.xml with parent" do
assert_difference 'WikiPage.count' do
assert_difference 'WikiContent::Version.count' do
assert_difference 'WikiContentVersion.count' do
put(
'/projects/ecookbook/wiki/New_subpage_from_API.xml',
:params => {

+ 1
- 1
test/unit/activity_test.rb View File

@@ -128,7 +128,7 @@ class ActivityTest < ActiveSupport::TestCase
end

def test_event_group_for_wiki_content_version
content = WikiContent::Version.find(1)
content = WikiContentVersion.find(1)
assert_equal content.page, content.event_group
end


+ 1
- 1
test/unit/project_test.rb View File

@@ -287,7 +287,7 @@ class ProjectTest < ActiveSupport::TestCase
assert_equal 0, Wiki.count
assert_equal 0, WikiPage.count
assert_equal 0, WikiContent.count
assert_equal 0, WikiContent::Version.count
assert_equal 0, WikiContentVersion.count
assert_equal 0, Project.connection.select_all("SELECT * FROM projects_trackers").count
assert_equal 0, Project.connection.select_all("SELECT * FROM custom_fields_projects").count
assert_equal 0, CustomValue.where(:customized_type => ['Project', 'Issue', 'TimeEntry', 'Version']).count

+ 1
- 1
test/unit/user_test.rb View File

@@ -425,7 +425,7 @@ class UserTest < ActiveSupport::TestCase
:start_page => 'Start'))
)
wiki_content.text = 'bar'
assert_difference 'WikiContent::Version.count' do
assert_difference 'WikiContentVersion.count' do
wiki_content.save!
end


+ 1
- 1
test/unit/wiki_page_test.rb View File

@@ -199,7 +199,7 @@ class WikiPageTest < ActiveSupport::TestCase
end

def test_diff_for_page_with_deleted_version_should_pick_the_previous_available_version
WikiContent::Version.find_by_page_id_and_version(1, 2).destroy
WikiContentVersion.find_by_page_id_and_version(1, 2).destroy

page = WikiPage.find(1)
diff = page.diff(3)

Loading…
Cancel
Save