Commit dbc10d27 authored by Felix Schäfer's avatar Felix Schäfer

Save the comments to wiki page updates correctly. #415

parent 0957e478
......@@ -23,6 +23,10 @@ class WikiContent < ActiveRecord::Base
validates_presence_of :text
validates_length_of :comments, :maximum => 255, :allow_nil => true
attr_accessor :comments
before_save :comments_to_journal_notes
acts_as_journalized :event_type => 'wiki-page',
:event_title => Proc.new {|o| "#{l(:label_wiki_edit)}: #{o.page.title} (##{o.version})"},
:event_url => Proc.new {|o| {:controller => 'wiki', :id => o.page.wiki.project_id, :page => o.page.title, :version => o.version}},
......@@ -67,6 +71,12 @@ class WikiContent < ActiveRecord::Base
last_journal.version
end
private
def comments_to_journal_notes
self.init_journal(author, comments)
end
# FIXME: This is for backwards compatibility only. Remove once we decide it is not needed anymore
WikiContentJournal.class_eval do
attr_protected :data
......
class RemoveCommentsFromWikiContent < ActiveRecord::Migration
def self.up
remove_column :wiki_contents, :comments
end
def self.down
add_column :wiki_contents, :comments, :string
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment