diff --git a/.rubocop.yml b/.rubocop.yml
index f0cae8cbd7..0ca5405170 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -94,6 +94,7 @@ Metrics/BlockNesting:
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricscyclomaticcomplexity
Metrics/CyclomaticComplexity:
Exclude:
+ - 'app/lib/feed_manager.rb'
- 'app/policies/status_policy.rb'
- 'app/services/activitypub/process_account_service.rb'
- 'app/services/post_status_service.rb'
diff --git a/app/javascript/mastodon/features/list_timeline/index.jsx b/app/javascript/mastodon/features/list_timeline/index.jsx
index 3801057549..38879997fb 100644
--- a/app/javascript/mastodon/features/list_timeline/index.jsx
+++ b/app/javascript/mastodon/features/list_timeline/index.jsx
@@ -209,7 +209,7 @@ class ListTimeline extends PureComponent {
diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json
index 3ed2032d88..8a23e39178 100644
--- a/app/javascript/mastodon/locales/en.json
+++ b/app/javascript/mastodon/locales/en.json
@@ -365,7 +365,7 @@
"lists.delete": "Delete list",
"lists.edit": "Edit list",
"lists.edit.submit": "Change title",
- "lists.exclusive": "Hide these posts from home",
+ "lists.exclusive": "Hide these posts from home or STL",
"lists.new.create": "Add list",
"lists.new.title_placeholder": "New list title",
"lists.replies_policy.followed": "Any followed user",
diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb
index df4c47884d..ac7eb9fdb8 100644
--- a/app/lib/feed_manager.rb
+++ b/app/lib/feed_manager.rb
@@ -37,12 +37,12 @@ class FeedManager
# @param [Status] status
# @param [Account|List] receiver
# @return [Boolean]
- def filter?(timeline_type, status, receiver)
+ def filter?(timeline_type, status, receiver, stl_home = false) # rubocop:disable Style/OptionalBooleanParameter
case timeline_type
when :home
filter_from_home?(status, receiver.id, build_crutches(receiver.id, [status]), :home)
when :list
- filter_from_list?(status, receiver) || filter_from_home?(status, receiver.account_id, build_crutches(receiver.account_id, [status]), :list)
+ filter_from_list?(status, receiver) || filter_from_home?(status, receiver.account_id, build_crutches(receiver.account_id, [status]), :list, stl_home)
when :mentions
filter_from_mentions?(status, receiver.id)
when :tags
@@ -351,10 +351,10 @@ class FeedManager
# @param [Integer] receiver_id
# @param [Hash] crutches
# @return [Boolean]
- def filter_from_home?(status, receiver_id, crutches, timeline_type = :home)
+ def filter_from_home?(status, receiver_id, crutches, timeline_type = :home, stl_home = false) # rubocop:disable Style/OptionalBooleanParameter
return false if receiver_id == status.account_id
return true if status.reply? && (status.in_reply_to_id.nil? || status.in_reply_to_account_id.nil?)
- return true if timeline_type != :list && crutches[:exclusive_list_users][status.account_id].present?
+ return true if (timeline_type != :list || stl_home) && crutches[:exclusive_list_users][status.account_id].present?
return true if crutches[:languages][status.account_id].present? && status.language.present? && !crutches[:languages][status.account_id].include?(status.language)
check_for_blocks = crutches[:active_mentions][status.id] || []
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index 6bc9401e24..951b766ff7 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -121,9 +121,10 @@ class FanOutOnWriteService < BaseService
antennas = Antenna.available_stls
antennas = antennas.where(account_id: Account.without_suspended.joins(:user).select('accounts.id').where('users.current_sign_in_at > ?', User::ACTIVE_DURATION.ago))
- antennas = antennas.where(account: @account.followers).or(antennas.where(account: @account)).where.not(list_id: 0) if !@account.domain.nil? || @status.reblog? || [:public, :public_unlisted, :login].exclude?(@status.visibility.to_sym)
+ home_post = !@account.domain.nil? || @status.reblog? || [:public, :public_unlisted, :login].exclude?(@status.visibility.to_sym)
+ antennas = antennas.where(account: @account.followers).or(antennas.where(account: @account)).where.not(list_id: 0) if home_post
- collection = AntennaCollection.new(@status, @options[:update])
+ collection = AntennaCollection.new(@status, @options[:update], home_post)
antennas.in_batches do |ans|
ans.each do |antenna|
@@ -155,7 +156,7 @@ class FanOutOnWriteService < BaseService
antennas = antennas.where(account_id: Account.without_suspended.joins(:user).select('accounts.id').where('users.current_sign_in_at > ?', User::ACTIVE_DURATION.ago))
- collection = AntennaCollection.new(@status, @options[:update])
+ collection = AntennaCollection.new(@status, @options[:update], false)
antennas.in_batches do |ans|
ans.each do |antenna|
@@ -242,9 +243,10 @@ class FanOutOnWriteService < BaseService
end
class AntennaCollection
- def initialize(status, update)
+ def initialize(status, update, stl_home = false) # rubocop:disable Style/OptionalBooleanParameter
@status = status
@update = update
+ @stl_home = stl_home
@home_account_ids = []
@list_ids = []
end
@@ -263,7 +265,7 @@ class FanOutOnWriteService < BaseService
if lists.any?
FeedInsertWorker.push_bulk(lists) do |list|
- [@status.id, list, 'list', { 'update' => @update }]
+ [@status.id, list, 'list', { 'update' => @update, 'stl_home' => @stl_home || false }]
end
end
diff --git a/app/workers/feed_insert_worker.rb b/app/workers/feed_insert_worker.rb
index 758cebd4ba..bbd1962a74 100644
--- a/app/workers/feed_insert_worker.rb
+++ b/app/workers/feed_insert_worker.rb
@@ -39,7 +39,7 @@ class FeedInsertWorker
when :tags
FeedManager.instance.filter?(:tags, @status, @follower)
when :list
- FeedManager.instance.filter?(:list, @status, @list)
+ FeedManager.instance.filter?(:list, @status, @list, stl_home?)
end
end
@@ -74,4 +74,8 @@ class FeedInsertWorker
def update?
@options[:update]
end
+
+ def stl_home?
+ @options[:stl_home]
+ end
end