group unread count

This commit is contained in:
2458773093
2019-07-20 01:06:32 +03:00
parent 04b219355c
commit a6f09dc0c7
5 changed files with 19 additions and 1 deletions

View File

@@ -256,6 +256,7 @@ 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
@@ -535,4 +536,8 @@ class Status < ApplicationRecord
AccountConversation.remove_status(inbox_owner, self)
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