From b8bae9664711f99bfb438687ff3b4b396db69924 Mon Sep 17 00:00:00 2001 From: Lex Alexander Date: Thu, 12 Oct 2017 14:52:09 -1000 Subject: Retoot count increases without reason (#5363) * Retoot count increases without reason -The store_uri method for Statuses was being called on after_create and causing reblogs to be incremented twice. -This calls it when the transaction is finished by using after_create_commit. -Fixes #4916. * Added test case for after_create_commit callback for checking reblog count. * Rewrote test to keep original, but added one for only the after_create_commit callback. --- app/models/status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/status.rb b/app/models/status.rb index 0d249244f..6db1f2a4c 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -134,7 +134,7 @@ class Status < ApplicationRecord CustomEmoji.from_text([spoiler_text, text].join(' '), account.domain) end - after_create :store_uri, if: :local? + after_create_commit :store_uri, if: :local? around_create Mastodon::Snowflake::Callbacks -- cgit