0001-Remove-WikiContent-Version.patch

Go MAEDA, 2021-04-04 17:52

Download (8.92 KB)

View differences:

app/helpers/application_helper.rb
976 976
          wiki_page = link_project.wiki.find_page(page)
977 977
          url =
978 978
            if anchor.present? && wiki_page.present? &&
979
                 (obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)) &&
979
                 (obj.is_a?(WikiContent) || obj.is_a?(WikiContentVersion)) &&
980 980
                 obj.page == wiki_page
981 981
              "##{anchor}"
982 982
            else
......
1330 1330
      anchor = sanitize_anchor_name(item)
1331 1331
      # used for single-file wiki export
1332 1332
      if options[:wiki_links] == :anchor && (obj.is_a?(WikiContent) ||
1333
           obj.is_a?(WikiContent::Version))
1333
           obj.is_a?(WikiContentVersion))
1334 1334
        anchor = "#{obj.page.title}_#{anchor}"
1335 1335
      end
1336 1336
      @heading_anchors[anchor] ||= 0
app/models/user.rb
948 948
    Token.where('user_id = ?', id).delete_all
949 949
    Watcher.where('user_id = ?', id).delete_all
950 950
    WikiContent.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
951
    WikiContent::Version.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
951
    WikiContentVersion.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
952 952
  end
953 953

  
954 954
  # Singleton class method is public
app/models/wiki_content.rb
98 98
      Mailer.deliver_wiki_content_updated(self)
99 99
    end
100 100
  end
101

  
102
  # For backward compatibility
103
  # TODO: remove it in Redmine 5
104
  Version = WikiContentVersion
105 101
end
lib/redmine.rb
420 420
  activity.register :news
421 421
  activity.register :documents, :class_name => %w(Document Attachment)
422 422
  activity.register :files, :class_name => 'Attachment'
423
  activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false
423
  activity.register :wiki_edits, :class_name => 'WikiContentVersion', :default => false
424 424
  activity.register :messages, :default => false
425 425
  activity.register :time_entries, :default => false
426 426
end
lib/redmine/wiki_formatting/macros.rb
202 202
        page = nil
203 203
        if args.size > 0
204 204
          page = Wiki.find_page(args.first.to_s, :project => @project)
205
        elsif obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)
205
        elsif obj.is_a?(WikiContent) || obj.is_a?(WikiContentVersion)
206 206
          page = obj.page
207 207
        else
208 208
          raise t(:error_childpages_macro_no_argument)
test/integration/api_test/wiki_pages_test.rb
104 104

  
105 105
  test "PUT /projects/:project_id/wiki/:title.xml should update wiki page" do
106 106
    assert_no_difference 'WikiPage.count' do
107
      assert_difference 'WikiContent::Version.count' do
107
      assert_difference 'WikiContentVersion.count' do
108 108
        put(
109 109
          '/projects/ecookbook/wiki/CookBook_documentation.xml',
110 110
          :params => {
......
128 128

  
129 129
  test "PUT /projects/:project_id/wiki/:title.xml with current versino should update wiki page" do
130 130
    assert_no_difference 'WikiPage.count' do
131
      assert_difference 'WikiContent::Version.count' do
131
      assert_difference 'WikiContentVersion.count' do
132 132
        put(
133 133
          '/projects/ecookbook/wiki/CookBook_documentation.xml',
134 134
          :params => {
......
153 153

  
154 154
  test "PUT /projects/:project_id/wiki/:title.xml with stale version should respond with 409" do
155 155
    assert_no_difference 'WikiPage.count' do
156
      assert_no_difference 'WikiContent::Version.count' do
156
      assert_no_difference 'WikiContentVersion.count' do
157 157
        put(
158 158
          '/projects/ecookbook/wiki/CookBook_documentation.xml',
159 159
          :params => {
......
172 172

  
173 173
  test "PUT /projects/:project_id/wiki/:title.xml should create the page if it does not exist" do
174 174
    assert_difference 'WikiPage.count' do
175
      assert_difference 'WikiContent::Version.count' do
175
      assert_difference 'WikiContentVersion.count' do
176 176
        put(
177 177
          '/projects/ecookbook/wiki/New_page_from_API.xml',
178 178
          :params => {
......
200 200
    set_tmp_attachments_directory
201 201
    attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2)
202 202
    assert_difference 'WikiPage.count' do
203
      assert_difference 'WikiContent::Version.count' do
203
      assert_difference 'WikiContentVersion.count' do
204 204
        put(
205 205
          '/projects/ecookbook/wiki/New_page_from_API.xml',
206 206
          :params => {
......
228 228

  
229 229
  test "PUT /projects/:project_id/wiki/:title.xml with parent" do
230 230
    assert_difference 'WikiPage.count' do
231
      assert_difference 'WikiContent::Version.count' do
231
      assert_difference 'WikiContentVersion.count' do
232 232
        put(
233 233
          '/projects/ecookbook/wiki/New_subpage_from_API.xml',
234 234
          :params => {
test/unit/activity_test.rb
128 128
  end
129 129

  
130 130
  def test_event_group_for_wiki_content_version
131
    content = WikiContent::Version.find(1)
131
    content = WikiContentVersion.find(1)
132 132
    assert_equal content.page, content.event_group
133 133
  end
134 134

  
test/unit/project_test.rb
287 287
    assert_equal 0, Wiki.count
288 288
    assert_equal 0, WikiPage.count
289 289
    assert_equal 0, WikiContent.count
290
    assert_equal 0, WikiContent::Version.count
290
    assert_equal 0, WikiContentVersion.count
291 291
    assert_equal 0, Project.connection.select_all("SELECT * FROM projects_trackers").count
292 292
    assert_equal 0, Project.connection.select_all("SELECT * FROM custom_fields_projects").count
293 293
    assert_equal 0, CustomValue.where(:customized_type => ['Project', 'Issue', 'TimeEntry', 'Version']).count
test/unit/user_test.rb
425 425
                                                      :start_page => 'Start'))
426 426
    )
427 427
    wiki_content.text = 'bar'
428
    assert_difference 'WikiContent::Version.count' do
428
    assert_difference 'WikiContentVersion.count' do
429 429
      wiki_content.save!
430 430
    end
431 431

  
test/unit/wiki_page_test.rb
199 199
  end
200 200

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

  
204 204
    page = WikiPage.find(1)
205 205
    diff = page.diff(3)
206
-