Skip to content

Commit

Permalink
update status query to public visablity only (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtomchak authored Dec 11, 2023
1 parent 58df4f8 commit bada19f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/lib/mammoth/channels.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def filter_statuses_with_threshold
end

def statuses_from_channels(account_ids)
Status.where(account_id: account_ids,
created_at: (GO_BACK.hours.ago)..Time.current)
Status.with_public_visibility.where(account_id: account_ids,
created_at: (GO_BACK.hours.ago)..Time.current)
end

# Check status for Channel's set level of engagment
Expand Down
4 changes: 2 additions & 2 deletions app/lib/mammoth/curated_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def curated_list_statuses
def statuses_from_list(account_ids)
cache_key = 'mammoth_picks:statuses'
Rails.cache.fetch(cache_key, expires_in: 120.seconds) do
statuses = Status.where(account_id: account_ids,
created_at: (GO_BACK.hours.ago)..Time.current).to_a
statuses = Status.with_public_visibility.where(account_id: account_ids,
created_at: (GO_BACK.hours.ago)..Time.current).to_a

statuses.filter_map { |s| engagment_threshold(s) }.pluck(:id, :account_id).map { |id, account_id| { id: id, account_id: account_id } }
end
Expand Down
4 changes: 2 additions & 2 deletions app/lib/personal_for_you.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def statuses_for_indirect_follows(account_handle)
Rails.logger.debug { "INDIRECT FOLLOW RECOMMENDATIONS USERNAMES\n #{username_query}" }
Rails.logger.debug { "INDIRECT FOLLOW RECOMMENDATIONS ACCOUNT_IDS\n #{account_ids}" }
# Get Statuses for those accounts
Status.where(account_id: account_ids, updated_at: 12.hours.ago..Time.current).limit(200)
Status.with_public_visibility.where(account_id: account_ids, updated_at: 12.hours.ago..Time.current).limit(200)
end

# Get All registered users from AcctRely
Expand Down Expand Up @@ -156,7 +156,7 @@ def statuses_for_direct_follows(acct)
# Array of account id's from fedi_account_handles
account_ids = Account.where(username: username_query, domain: domain_query).pluck(:id)
# Get Statuses for those accounts
Status.where(account_id: account_ids, updated_at: 12.hours.ago..Time.current).limit(200)
Status.with_public_visibility.where(account_id: account_ids, updated_at: 12.hours.ago..Time.current).limit(200)
end

# Get enabled channels with full accounts
Expand Down

0 comments on commit bada19f

Please sign in to comment.