diff --git a/Changelog.md b/Changelog.md index 0ebe5d65b..2af63d5ba 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ ## Bug fixes * Improve time agos by updating the plugin [#4280](https://github.com/diaspora/diaspora/issues/4280) +* Fix regression caused by using after_commit with nested '#save' which lead to an infinite recursion [#4715](https://github.com/diaspora/diaspora/issues/4715) ## Features * You can report a single post by clicking the correct icon in the controler section [#4517](https://github.com/diaspora/diaspora/pull/4517) diff --git a/app/models/message.rb b/app/models/message.rb index c0bbcb38a..60de53d3d 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -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