This commit is contained in:
mgabdev
2020-05-09 23:57:38 -04:00
parent 2c9030f3a3
commit bb0182c1e1
9 changed files with 15 additions and 27 deletions

View File

@@ -26,6 +26,7 @@
# group_id :integer
# quote_of_id :bigint(8)
# revised_at :datetime
# markdown :text
#
class Status < ApplicationRecord
@@ -268,7 +269,6 @@ class Status < ApplicationRecord
after_create_commit :store_uri, if: :local?
after_create_commit :update_statistics, if: :local?
after_create_commit :increase_group_unread_counts, if: Proc.new { |status| !status.group_id.nil? }
around_create GabSocial::Snowflake::Callbacks
@@ -555,7 +555,4 @@ class Status < ApplicationRecord
end
end
def increase_group_unread_counts
GroupAccount.where(group_id: group_id).where.not(account_id: account_id).update_all("unread_count = unread_count + 1")
end
end