mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Add Status.not_direct_visibility
scope
This commit is contained in:
parent
cfb8fc6222
commit
d565d5eda2
@ -130,7 +130,7 @@ class AccountStatusesCleanupPolicy < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def without_direct_scope
|
def without_direct_scope
|
||||||
Status.where.not(visibility: :direct)
|
Status.not_direct_visibility
|
||||||
end
|
end
|
||||||
|
|
||||||
def old_enough_scope(max_id = nil)
|
def old_enough_scope(max_id = nil)
|
||||||
|
@ -127,6 +127,7 @@ class Status < ApplicationRecord
|
|||||||
}
|
}
|
||||||
scope :distributable_visibility, -> { where(visibility: %i(public unlisted)) }
|
scope :distributable_visibility, -> { where(visibility: %i(public unlisted)) }
|
||||||
scope :list_eligible_visibility, -> { where(visibility: %i(public unlisted private)) }
|
scope :list_eligible_visibility, -> { where(visibility: %i(public unlisted private)) }
|
||||||
|
scope :not_direct_visibility, -> { where.not(visibility: :direct) }
|
||||||
|
|
||||||
after_create_commit :trigger_create_webhooks
|
after_create_commit :trigger_create_webhooks
|
||||||
after_update_commit :trigger_update_webhooks
|
after_update_commit :trigger_update_webhooks
|
||||||
|
@ -52,7 +52,7 @@ module Mastodon::CLI
|
|||||||
account.account_stat.tap do |account_stat|
|
account.account_stat.tap do |account_stat|
|
||||||
account_stat.following_count = account.active_relationships.count
|
account_stat.following_count = account.active_relationships.count
|
||||||
account_stat.followers_count = account.passive_relationships.count
|
account_stat.followers_count = account.passive_relationships.count
|
||||||
account_stat.statuses_count = account.statuses.where.not(visibility: :direct).count
|
account_stat.statuses_count = account.statuses.not_direct_visibility.count
|
||||||
|
|
||||||
account_stat.save if account_stat.changed?
|
account_stat.save if account_stat.changed?
|
||||||
end
|
end
|
||||||
@ -60,7 +60,7 @@ module Mastodon::CLI
|
|||||||
|
|
||||||
def recount_status_stats(status)
|
def recount_status_stats(status)
|
||||||
status.status_stat.tap do |status_stat|
|
status.status_stat.tap do |status_stat|
|
||||||
status_stat.replies_count = status.replies.where.not(visibility: :direct).count
|
status_stat.replies_count = status.replies.not_direct_visibility.count
|
||||||
status_stat.reblogs_count = status.reblogs.count
|
status_stat.reblogs_count = status.reblogs.count
|
||||||
status_stat.favourites_count = status.favourites.count
|
status_stat.favourites_count = status.favourites.count
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user