Remove deprecated WikiContent::Version (#35031).

git-svn-id: http://svn.redmine.org/redmine/trunk@21002 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2021-05-15 05:51:14 +00:00
parent 4740307f11
commit ec3527102d
10 changed files with 15 additions and 19 deletions

View File

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

View File

@@ -948,7 +948,7 @@ class User < Principal
Token.where('user_id = ?', id).delete_all Token.where('user_id = ?', id).delete_all
Watcher.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.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 end
# Singleton class method is public # Singleton class method is public

View File

@@ -98,8 +98,4 @@ class WikiContent < ActiveRecord::Base
Mailer.deliver_wiki_content_updated(self) Mailer.deliver_wiki_content_updated(self)
end end
end end
# For backward compatibility
# TODO: remove it in Redmine 5
Version = WikiContentVersion
end end

View File

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

View File

@@ -202,7 +202,7 @@ module Redmine
page = nil page = nil
if args.size > 0 if args.size > 0
page = Wiki.find_page(args.first.to_s, :project => @project) 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 page = obj.page
else else
raise t(:error_childpages_macro_no_argument) raise t(:error_childpages_macro_no_argument)

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 test "PUT /projects/:project_id/wiki/:title.xml should update wiki page" do
assert_no_difference 'WikiPage.count' do assert_no_difference 'WikiPage.count' do
assert_difference 'WikiContent::Version.count' do assert_difference 'WikiContentVersion.count' do
put( put(
'/projects/ecookbook/wiki/CookBook_documentation.xml', '/projects/ecookbook/wiki/CookBook_documentation.xml',
:params => { :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 test "PUT /projects/:project_id/wiki/:title.xml with current versino should update wiki page" do
assert_no_difference 'WikiPage.count' do assert_no_difference 'WikiPage.count' do
assert_difference 'WikiContent::Version.count' do assert_difference 'WikiContentVersion.count' do
put( put(
'/projects/ecookbook/wiki/CookBook_documentation.xml', '/projects/ecookbook/wiki/CookBook_documentation.xml',
:params => { :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 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 'WikiPage.count' do
assert_no_difference 'WikiContent::Version.count' do assert_no_difference 'WikiContentVersion.count' do
put( put(
'/projects/ecookbook/wiki/CookBook_documentation.xml', '/projects/ecookbook/wiki/CookBook_documentation.xml',
:params => { :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 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 'WikiPage.count' do
assert_difference 'WikiContent::Version.count' do assert_difference 'WikiContentVersion.count' do
put( put(
'/projects/ecookbook/wiki/New_page_from_API.xml', '/projects/ecookbook/wiki/New_page_from_API.xml',
:params => { :params => {
@@ -200,7 +200,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base
set_tmp_attachments_directory set_tmp_attachments_directory
attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2) attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2)
assert_difference 'WikiPage.count' do assert_difference 'WikiPage.count' do
assert_difference 'WikiContent::Version.count' do assert_difference 'WikiContentVersion.count' do
put( put(
'/projects/ecookbook/wiki/New_page_from_API.xml', '/projects/ecookbook/wiki/New_page_from_API.xml',
:params => { :params => {
@@ -228,7 +228,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base
test "PUT /projects/:project_id/wiki/:title.xml with parent" do test "PUT /projects/:project_id/wiki/:title.xml with parent" do
assert_difference 'WikiPage.count' do assert_difference 'WikiPage.count' do
assert_difference 'WikiContent::Version.count' do assert_difference 'WikiContentVersion.count' do
put( put(
'/projects/ecookbook/wiki/New_subpage_from_API.xml', '/projects/ecookbook/wiki/New_subpage_from_API.xml',
:params => { :params => {

View File

@@ -128,7 +128,7 @@ class ActivityTest < ActiveSupport::TestCase
end end
def test_event_group_for_wiki_content_version def test_event_group_for_wiki_content_version
content = WikiContent::Version.find(1) content = WikiContentVersion.find(1)
assert_equal content.page, content.event_group assert_equal content.page, content.event_group
end end

View File

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

View File

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

View File

@@ -199,7 +199,7 @@ class WikiPageTest < ActiveSupport::TestCase
end end
def test_diff_for_page_with_deleted_version_should_pick_the_previous_available_version 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) page = WikiPage.find(1)
diff = page.diff(3) diff = page.diff(3)