Commit a4ce6e26 authored by Ivan Zotov's avatar Ivan Zotov

Fix after_create to after_commit

parent 42f790fa
...@@ -7,7 +7,7 @@ class AccountDeletion < ActiveRecord::Base ...@@ -7,7 +7,7 @@ class AccountDeletion < ActiveRecord::Base
belongs_to :person belongs_to :person
after_create :queue_delete_account after_commit :queue_delete_account, :on => :create
xml_name :account_deletion xml_name :account_deletion
xml_attr :diaspora_handle xml_attr :diaspora_handle
......
...@@ -41,7 +41,7 @@ class Comment < ActiveRecord::Base ...@@ -41,7 +41,7 @@ class Comment < ActiveRecord::Base
self.post.touch self.post.touch
end end
after_create do after_commit :on => :create do
self.parent.update_comments_counter self.parent.update_comments_counter
end end
......
...@@ -13,7 +13,7 @@ class Like < Federated::Relayable ...@@ -13,7 +13,7 @@ class Like < Federated::Relayable
end end
end end
after_create do after_commit :on => :create do
self.parent.update_likes_counter self.parent.update_likes_counter
end end
......
...@@ -17,7 +17,7 @@ class Message < ActiveRecord::Base ...@@ -17,7 +17,7 @@ class Message < ActiveRecord::Base
validates :text, :presence => true validates :text, :presence => true
validate :participant_of_parent_conversation validate :participant_of_parent_conversation
after_create do after_commit :on => :create do
#sign comment as commenter #sign comment as commenter
self.author_signature = self.sign_with_key(self.author.owner.encryption_key) if self.author.owner self.author_signature = self.sign_with_key(self.author.owner.encryption_key) if self.author.owner
......
...@@ -46,7 +46,7 @@ class Photo < ActiveRecord::Base ...@@ -46,7 +46,7 @@ class Photo < ActiveRecord::Base
before_destroy :ensure_user_picture before_destroy :ensure_user_picture
after_destroy :clear_empty_status_message after_destroy :clear_empty_status_message
after_create do after_commit :on => :create do
queue_processing_job if self.author.local? queue_processing_job if self.author.local?
end end
......
...@@ -26,7 +26,7 @@ class Post < ActiveRecord::Base ...@@ -26,7 +26,7 @@ class Post < ActiveRecord::Base
belongs_to :o_embed_cache belongs_to :o_embed_cache
belongs_to :open_graph_cache belongs_to :open_graph_cache
after_create do after_commit :on => :create do
self.touch(:interacted_at) self.touch(:interacted_at)
end end
......
...@@ -17,7 +17,7 @@ class Reshare < Post ...@@ -17,7 +17,7 @@ class Reshare < Post
self.public = true self.public = true
end end
after_create do after_commit :on => :create do
self.root.update_reshares_counter self.root.update_reshares_counter
end end
......
...@@ -34,7 +34,7 @@ class StatusMessage < Post ...@@ -34,7 +34,7 @@ class StatusMessage < Post
before_create :filter_mentions before_create :filter_mentions
after_create :create_mentions after_create :create_mentions
after_create :queue_gather_oembed_data, :if => :contains_oembed_url_in_text? after_commit :queue_gather_oembed_data, :on => :create, :if => :contains_oembed_url_in_text?
after_commit :queue_gather_open_graph_data, :on => :create, :if => :contains_open_graph_url_in_text? after_commit :queue_gather_open_graph_data, :on => :create, :if => :contains_open_graph_url_in_text?
#scopes #scopes
......
...@@ -20,7 +20,7 @@ module Diaspora ...@@ -20,7 +20,7 @@ module Diaspora
delegate :public?, to: :parent delegate :public?, to: :parent
delegate :author, :diaspora_handle, to: :parent, prefix: true delegate :author, :diaspora_handle, to: :parent, prefix: true
after_create do after_commit :on => :create do
parent.touch(:interacted_at) if parent.respond_to?(:interacted_at) parent.touch(:interacted_at) if parent.respond_to?(:interacted_at)
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