diff --git a/app/models/article.rb b/app/models/article.rb index 1a615ea..53a80c7 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -203,6 +203,10 @@ class Article < ActiveRecord::Base acts_as_versioned self.non_versioned_columns << 'setting' + def version_condition_met? + (['name', 'body', 'abstract', 'filename', 'start_date', 'end_date', 'image_id', 'license_id'] & changed).length > 0 + end + def comment_data comments.map {|item| [item.title, item.body].join(' ') }.join(' ') end diff --git a/test/unit/article_test.rb b/test/unit/article_test.rb index 0a6a8a8..b7fc0f4 100644 --- a/test/unit/article_test.rb +++ b/test/unit/article_test.rb @@ -1825,4 +1825,10 @@ class ArticleTest < ActiveSupport::TestCase assert_equivalent [c3], Article.with_types(['Event']) end + should 'not create version when receive a comment' do + a = Article.create!(:name => 'my article', :body => 'my text', :profile_id => profile.id) + Comment.create!(:title => 'test', :body => 'asdsad', :author => profile, :source => a) + assert_equal 1, a.versions.count + end + end -- libgit2 0.21.2