Remove preference to aggregate reblogs in home/list feeds (#18112)
This commit is contained in:
parent
7300beadd9
commit
dd5b90e4f2
2 changed files with 9 additions and 12 deletions
|
@ -58,7 +58,7 @@ class FeedManager
|
||||||
# @param [Boolean] update
|
# @param [Boolean] update
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def push_to_home(account, status, update: false)
|
def push_to_home(account, status, update: false)
|
||||||
return false unless add_to_feed(:home, account.id, status, aggregate_reblogs: account.user&.aggregates_reblogs?)
|
return false unless add_to_feed(:home, account.id, status, aggregate_reblogs: true)
|
||||||
|
|
||||||
trim(:home, account.id)
|
trim(:home, account.id)
|
||||||
PushUpdateWorker.perform_async(account.id, status.id, "timeline:#{account.id}", { 'update' => update }) if push_update_required?("timeline:#{account.id}")
|
PushUpdateWorker.perform_async(account.id, status.id, "timeline:#{account.id}", { 'update' => update }) if push_update_required?("timeline:#{account.id}")
|
||||||
|
@ -71,7 +71,7 @@ class FeedManager
|
||||||
# @param [Boolean] update
|
# @param [Boolean] update
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def unpush_from_home(account, status, update: false)
|
def unpush_from_home(account, status, update: false)
|
||||||
return false unless remove_from_feed(:home, account.id, status, aggregate_reblogs: account.user&.aggregates_reblogs?)
|
return false unless remove_from_feed(:home, account.id, status, aggregate_reblogs: true)
|
||||||
|
|
||||||
redis.publish("timeline:#{account.id}", Oj.dump(event: :delete, payload: status.id.to_s)) unless update
|
redis.publish("timeline:#{account.id}", Oj.dump(event: :delete, payload: status.id.to_s)) unless update
|
||||||
true
|
true
|
||||||
|
@ -83,7 +83,7 @@ class FeedManager
|
||||||
# @param [Boolean] update
|
# @param [Boolean] update
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def push_to_list(list, status, update: false)
|
def push_to_list(list, status, update: false)
|
||||||
return false if filter_from_list?(status, list) || !add_to_feed(:list, list.id, status, aggregate_reblogs: list.account.user&.aggregates_reblogs?)
|
return false if filter_from_list?(status, list) || !add_to_feed(:list, list.id, status, aggregate_reblogs: true)
|
||||||
|
|
||||||
trim(:list, list.id)
|
trim(:list, list.id)
|
||||||
PushUpdateWorker.perform_async(list.account_id, status.id, "timeline:list:#{list.id}", { 'update' => update }) if push_update_required?("timeline:list:#{list.id}")
|
PushUpdateWorker.perform_async(list.account_id, status.id, "timeline:list:#{list.id}", { 'update' => update }) if push_update_required?("timeline:list:#{list.id}")
|
||||||
|
@ -96,7 +96,7 @@ class FeedManager
|
||||||
# @param [Boolean] update
|
# @param [Boolean] update
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def unpush_from_list(list, status, update: false)
|
def unpush_from_list(list, status, update: false)
|
||||||
return false unless remove_from_feed(:list, list.id, status, aggregate_reblogs: list.account.user&.aggregates_reblogs?)
|
return false unless remove_from_feed(:list, list.id, status, aggregate_reblogs: true)
|
||||||
|
|
||||||
redis.publish("timeline:list:#{list.id}", Oj.dump(event: :delete, payload: status.id.to_s)) unless update
|
redis.publish("timeline:list:#{list.id}", Oj.dump(event: :delete, payload: status.id.to_s)) unless update
|
||||||
true
|
true
|
||||||
|
@ -108,7 +108,7 @@ class FeedManager
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def merge_into_home(from_account, into_account)
|
def merge_into_home(from_account, into_account)
|
||||||
timeline_key = key(:home, into_account.id)
|
timeline_key = key(:home, into_account.id)
|
||||||
aggregate = into_account.user&.aggregates_reblogs?
|
aggregate = true
|
||||||
query = from_account.statuses.where(visibility: [:public, :unlisted, :private]).includes(:preloadable_poll, :media_attachments, reblog: :account).limit(FeedManager::MAX_ITEMS / 4)
|
query = from_account.statuses.where(visibility: [:public, :unlisted, :private]).includes(:preloadable_poll, :media_attachments, reblog: :account).limit(FeedManager::MAX_ITEMS / 4)
|
||||||
|
|
||||||
if redis.zcard(timeline_key) >= FeedManager::MAX_ITEMS / 4
|
if redis.zcard(timeline_key) >= FeedManager::MAX_ITEMS / 4
|
||||||
|
@ -134,7 +134,7 @@ class FeedManager
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def merge_into_list(from_account, list)
|
def merge_into_list(from_account, list)
|
||||||
timeline_key = key(:list, list.id)
|
timeline_key = key(:list, list.id)
|
||||||
aggregate = list.account.user&.aggregates_reblogs?
|
aggregate = true
|
||||||
query = from_account.statuses.where(visibility: [:public, :unlisted, :private]).includes(:preloadable_poll, :media_attachments, reblog: :account).limit(FeedManager::MAX_ITEMS / 4)
|
query = from_account.statuses.where(visibility: [:public, :unlisted, :private]).includes(:preloadable_poll, :media_attachments, reblog: :account).limit(FeedManager::MAX_ITEMS / 4)
|
||||||
|
|
||||||
if redis.zcard(timeline_key) >= FeedManager::MAX_ITEMS / 4
|
if redis.zcard(timeline_key) >= FeedManager::MAX_ITEMS / 4
|
||||||
|
@ -163,7 +163,7 @@ class FeedManager
|
||||||
timeline_status_ids = redis.zrange(timeline_key, 0, -1)
|
timeline_status_ids = redis.zrange(timeline_key, 0, -1)
|
||||||
|
|
||||||
from_account.statuses.select('id, reblog_of_id').where(id: timeline_status_ids).reorder(nil).find_each do |status|
|
from_account.statuses.select('id, reblog_of_id').where(id: timeline_status_ids).reorder(nil).find_each do |status|
|
||||||
remove_from_feed(:home, into_account.id, status, aggregate_reblogs: into_account.user&.aggregates_reblogs?)
|
remove_from_feed(:home, into_account.id, status, aggregate_reblogs: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class FeedManager
|
||||||
timeline_status_ids = redis.zrange(timeline_key, 0, -1)
|
timeline_status_ids = redis.zrange(timeline_key, 0, -1)
|
||||||
|
|
||||||
from_account.statuses.select('id, reblog_of_id').where(id: timeline_status_ids).reorder(nil).find_each do |status|
|
from_account.statuses.select('id, reblog_of_id').where(id: timeline_status_ids).reorder(nil).find_each do |status|
|
||||||
remove_from_feed(:list, list.id, status, aggregate_reblogs: list.account.user&.aggregates_reblogs?)
|
remove_from_feed(:list, list.id, status, aggregate_reblogs: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ class FeedManager
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def populate_home(account)
|
def populate_home(account)
|
||||||
limit = FeedManager::MAX_ITEMS / 2
|
limit = FeedManager::MAX_ITEMS / 2
|
||||||
aggregate = account.user&.aggregates_reblogs?
|
aggregate = true
|
||||||
timeline_key = key(:home, account.id)
|
timeline_key = key(:home, account.id)
|
||||||
|
|
||||||
account.statuses.limit(limit).each do |status|
|
account.statuses.limit(limit).each do |status|
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :setting_noindex, as: :boolean, wrapper: :with_label
|
= f.input :setting_noindex, as: :boolean, wrapper: :with_label
|
||||||
|
|
||||||
.fields-group
|
|
||||||
= f.input :setting_aggregate_reblogs, as: :boolean, wrapper: :with_label, recommended: true
|
|
||||||
|
|
||||||
%h4= t 'preferences.posting_defaults'
|
%h4= t 'preferences.posting_defaults'
|
||||||
|
|
||||||
.fields-row
|
.fields-row
|
||||||
|
|
Loading…
Reference in a new issue