Skip to content

Commit

Permalink
Fix direct inbox delivery pushing posts into inactive followers' time…
Browse files Browse the repository at this point in the history
…lines (mastodon#33067)
  • Loading branch information
ClearlyClaire authored Nov 25, 2024
1 parent 2d8fed2 commit 9a7130d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/lib/feed_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def filter?(timeline_type, status, receiver)
# @param [Boolean] update
# @return [Boolean]
def push_to_home(account, status, update: false)
return false unless account.user&.signed_in_recently?
return false unless add_to_feed(:home, account.id, status, aggregate_reblogs: account.user&.aggregates_reblogs?)

trim(:home, account.id)
Expand All @@ -83,7 +84,9 @@ def unpush_from_home(account, status, update: false)
# @param [Boolean] update
# @return [Boolean]
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)
return false unless list.account.user&.signed_in_recently?
return false unless add_to_feed(:list, list.id, status, aggregate_reblogs: list.account.user&.aggregates_reblogs?)

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}")
Expand Down
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ def role
end
end

def signed_in_recently?
current_sign_in_at.present? && current_sign_in_at >= ACTIVE_DURATION.ago
end

def confirmed?
confirmed_at.present?
end
Expand Down

0 comments on commit 9a7130d

Please sign in to comment.