Skip to content

Commit

Permalink
Merge pull request #2710 from ClearlyClaire/glitch-soc/merge-upstream
Browse files Browse the repository at this point in the history
Merge upstream changes up to b2388be
  • Loading branch information
ClearlyClaire committed May 16, 2024
2 parents 19ed3d9 + 2810231 commit 87b5cfc
Show file tree
Hide file tree
Showing 64 changed files with 521 additions and 228 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ Style/PercentLiteralDelimiters:
Style/RedundantBegin:
Enabled: false

# Reason: Prevailing style choice
# https://docs.rubocop.org/rubocop/cops_style.html#styleredundantfetchblock
Style/RedundantFetchBlock:
Enabled: false

# Reason: Overridden to reduce implicit StandardError rescues
# https://docs.rubocop.org/rubocop/cops_style.html#stylerescuestandarderror
Style/RescueStandardError:
Expand Down
10 changes: 0 additions & 10 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,6 @@ Style/RedundantConstantBase:
- 'config/environments/production.rb'
- 'config/initializers/sidekiq.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SafeForConstants.
Style/RedundantFetchBlock:
Exclude:
- 'config/initializers/1_hosts.rb'
- 'config/initializers/chewy.rb'
- 'config/initializers/devise.rb'
- 'config/initializers/paperclip.rb'
- 'config/puma.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
# AllowedMethods: present?, blank?, presence, try, try!
Expand Down
22 changes: 0 additions & 22 deletions .simplecov

This file was deleted.

4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ group :test do
gem 'email_spec'

# Extra RSpec extension methods and helpers for sidekiq
gem 'rspec-sidekiq', '~> 4.0'
gem 'rspec-sidekiq', '~> 5.0'

# Browser integration testing
gem 'capybara', '~> 3.39'
Expand Down Expand Up @@ -178,7 +178,7 @@ group :development do

# Preview mail in the browser
gem 'letter_opener', '~> 1.8'
gem 'letter_opener_web', '~> 2.0'
gem 'letter_opener_web', '~> 3.0'

# Security analysis CLI tools
gem 'brakeman', '~> 6.0', require: false
Expand Down
42 changes: 22 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ GEM
attr_required (1.0.2)
awrence (1.2.1)
aws-eventstream (1.3.0)
aws-partitions (1.922.0)
aws-sdk-core (3.194.1)
aws-partitions (1.929.0)
aws-sdk-core (3.196.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.80.0)
aws-sdk-kms (1.81.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.149.1)
aws-sdk-s3 (1.151.0)
aws-sdk-core (~> 3, >= 3.194.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
Expand Down Expand Up @@ -272,7 +272,7 @@ GEM
fog-json (1.2.0)
fog-core
multi_json (~> 1.10)
fog-openstack (1.1.0)
fog-openstack (1.1.1)
fog-core (~> 2.1)
fog-json (>= 1.0)
formatador (1.1.0)
Expand Down Expand Up @@ -389,10 +389,10 @@ GEM
addressable (~> 2.8)
letter_opener (1.10.0)
launchy (>= 2.2, < 4)
letter_opener_web (2.0.0)
actionmailer (>= 5.2)
letter_opener (~> 1.7)
railties (>= 5.2)
letter_opener_web (3.0.0)
actionmailer (>= 6.1)
letter_opener (~> 1.9)
railties (>= 6.1)
rexml
link_header (0.0.8)
llhttp-ffi (0.5.0)
Expand Down Expand Up @@ -422,7 +422,7 @@ GEM
memory_profiler (1.0.1)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0305)
mime-types-data (3.2024.0507)
mini_mime (1.1.5)
mini_portile2 (2.8.6)
minitest (5.22.3)
Expand All @@ -434,7 +434,7 @@ GEM
uri
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-imap (0.4.10)
net-imap (0.4.11)
date
net-protocol
net-ldap (0.19.0)
Expand All @@ -445,7 +445,7 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.1)
nokogiri (1.16.4)
nokogiri (1.16.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nsa (0.3.0)
Expand Down Expand Up @@ -686,14 +686,15 @@ GEM
redlock (1.3.2)
redis (>= 3.0.0, < 6.0)
regexp_parser (2.9.0)
reline (0.5.6)
reline (0.5.7)
io-console (~> 0.5)
request_store (1.6.0)
rack (>= 1.4)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.6)
rexml (3.2.8)
strscan (>= 3.0.9)
rotp (6.3.0)
rouge (4.2.1)
rpam2 (4.0.2)
Expand All @@ -708,7 +709,7 @@ GEM
rspec-support (~> 3.13.0)
rspec-github (2.4.0)
rspec-core (~> 3.0)
rspec-mocks (3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.2)
Expand All @@ -719,7 +720,7 @@ GEM
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-sidekiq (4.2.0)
rspec-sidekiq (5.0.0)
rspec-core (~> 3.0)
rspec-expectations (~> 3.0)
rspec-mocks (~> 3.0)
Expand Down Expand Up @@ -774,7 +775,7 @@ GEM
scenic (1.8.0)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
selenium-webdriver (4.20.1)
selenium-webdriver (4.21.0)
base64 (~> 0.2)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
Expand Down Expand Up @@ -815,6 +816,7 @@ GEM
stringio (3.1.0)
strong_migrations (1.8.0)
activerecord (>= 5.2)
strscan (3.1.0)
swd (1.3.0)
activesupport (>= 3)
attr_required (>= 0.0.5)
Expand Down Expand Up @@ -893,7 +895,7 @@ GEM
xorcist (1.1.3)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.13)
zeitwerk (2.6.14)

PLATFORMS
ruby
Expand Down Expand Up @@ -955,7 +957,7 @@ DEPENDENCIES
kaminari (~> 1.2)
kt-paperclip (~> 7.2)
letter_opener (~> 1.8)
letter_opener_web (~> 2.0)
letter_opener_web (~> 3.0)
link_header (~> 0.0)
lograge (~> 0.12)
mail (~> 2.8)
Expand Down Expand Up @@ -1012,7 +1014,7 @@ DEPENDENCIES
rqrcode (~> 2.2)
rspec-github (~> 2.4)
rspec-rails (~> 6.0)
rspec-sidekiq (~> 4.0)
rspec-sidekiq (~> 5.0)
rubocop
rubocop-capybara
rubocop-performance
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def show

limit = params[:limit].present? ? [params[:limit].to_i, PAGE_SIZE_MAX].min : PAGE_SIZE
@statuses = filtered_statuses.without_reblogs.limit(limit)
@statuses = cache_collection(@statuses, Status)
@statuses = preload_collection(@statuses, Status)
end

format.json do
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/activitypub/collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def show
def set_items
case params[:id]
when 'featured'
@items = for_signed_account { cache_collection(@account.pinned_statuses.not_local_only, Status) }
@items = for_signed_account { preload_collection(@account.pinned_statuses.not_local_only, Status) }
@items = @items.map { |item| item.distributable? ? item : ActivityPub::TagManager.instance.uri_for(item) }
when 'tags'
@items = for_signed_account { @account.featured_tags }
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/activitypub/outboxes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def prev_page
def set_statuses
return unless page_requested?

@statuses = cache_collection_paginated_by_id(
@statuses = preload_collection_paginated_by_id(
AccountStatusesFilter.new(@account, signed_request_account).results,
Status,
LIMIT,
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/v1/accounts/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ def set_account
end

def load_statuses
@account.unavailable? ? [] : cached_account_statuses
@account.unavailable? ? [] : preloaded_account_statuses
end

def cached_account_statuses
cache_collection_paginated_by_id(
def preloaded_account_statuses
preload_collection_paginated_by_id(
AccountStatusesFilter.new(@account, current_account, params).results,
Status,
limit_param(DEFAULT_STATUSES_LIMIT),
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/v1/bookmarks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def index
private

def load_statuses
cached_bookmarks
preloaded_bookmarks
end

def cached_bookmarks
cache_collection(results.map(&:status), Status)
def preloaded_bookmarks
preload_collection(results.map(&:status), Status)
end

def results
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/v1/favourites_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def index
private

def load_statuses
cached_favourites
preloaded_favourites
end

def cached_favourites
cache_collection(results.map(&:status), Status)
def preloaded_favourites
preload_collection(results.map(&:status), Status)
end

def results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def load_requests
)

NotificationRequest.preload_cache_collection(requests) do |statuses|
cache_collection(statuses, Status)
preload_collection(statuses, Status)
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def load_notifications
)

Notification.preload_cache_collection_target_statuses(notifications) do |target_statuses|
cache_collection(target_statuses, Status)
preload_collection(target_statuses, Status)
end
end

Expand Down
8 changes: 4 additions & 4 deletions app/controllers/api/v1/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class Api::V1::StatusesController < Api::BaseController
DESCENDANTS_DEPTH_LIMIT = 20

def index
@statuses = cache_collection(@statuses, Status)
@statuses = preload_collection(@statuses, Status)
render json: @statuses, each_serializer: REST::StatusSerializer
end

def show
cache_if_unauthenticated!
@status = cache_collection([@status], Status).first
@status = preload_collection([@status], Status).first
render json: @status, serializer: REST::StatusSerializer
end

Expand All @@ -51,8 +51,8 @@ def context

ancestors_results = @status.in_reply_to_id.nil? ? [] : @status.ancestors(ancestors_limit, current_account)
descendants_results = @status.descendants(descendants_limit, current_account, descendants_depth_limit)
loaded_ancestors = cache_collection(ancestors_results, Status)
loaded_descendants = cache_collection(descendants_results, Status)
loaded_ancestors = preload_collection(ancestors_results, Status)
loaded_descendants = preload_collection(descendants_results, Status)

@context = Context.new(ancestors: loaded_ancestors, descendants: loaded_descendants)
statuses = [@status] + @context.ancestors + @context.descendants
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/v1/timelines/direct_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ def show
private

def load_statuses
cached_direct_statuses
preloaded_direct_statuses
end

def cached_direct_statuses
cache_collection direct_statuses, Status
def preloaded_direct_statuses
preload_collection direct_statuses, Status
end

def direct_statuses
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/v1/timelines/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ def show
private

def load_statuses
cached_home_statuses
preloaded_home_statuses
end

def cached_home_statuses
cache_collection home_statuses, Status
def preloaded_home_statuses
preload_collection home_statuses, Status
end

def home_statuses
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/v1/timelines/list_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ def set_list
end

def set_statuses
@statuses = cached_list_statuses
@statuses = preloaded_list_statuses
end

def cached_list_statuses
cache_collection list_statuses, Status
def preloaded_list_statuses
preload_collection list_statuses, Status
end

def list_statuses
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/v1/timelines/public_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def require_auth?
end

def load_statuses
cached_public_statuses_page
preloaded_public_statuses_page
end

def cached_public_statuses_page
cache_collection(public_statuses, Status)
def preloaded_public_statuses_page
preload_collection(public_statuses, Status)
end

def public_statuses
Expand Down

0 comments on commit 87b5cfc

Please sign in to comment.