fix regression in conversations causing an infinite recursion (fix #4715)

(cherry picked from commit 5c059b2925)

Conflicts:
	Changelog.md
This commit is contained in:
Florian Staudacher 2014-01-20 22:00:26 +01:00 committed by Jason Robinson
parent 234ce10cf5
commit 0c5c17f5e2
2 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,8 @@
# 0.3.0.1
## Bug fixes
* Fix regression caused by using after_commit with nested '#save' which lead to an infinite recursion [#4715](https://github.com/diaspora/diaspora/issues/4715)
# 0.3.0.0
## Pod statistics

View file

@ -11,13 +11,14 @@ class Message < ActiveRecord::Base
belongs_to :author, :class_name => 'Person'
belongs_to :conversation, :touch => true
delegate :name, to: :author, prefix: true
validates :text, :presence => true
validate :participant_of_parent_conversation
after_commit :on => :create do
after_create do # don't use 'after_commit' here since there is a call to 'save!'
# inside, which would cause an infinite recursion
#sign comment as commenter
self.author_signature = self.sign_with_key(self.author.owner.encryption_key) if self.author.owner