Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream 20231221 #365

Merged
merged 51 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d791b47
Update dependency chewy to v7.4.0 (#28349)
renovate[bot] Dec 14, 2023
28e1a7a
Improve spec coverage for `models/announcement` class (#28350)
mjankowski Dec 14, 2023
cd9ebf5
Update stylelint to version 16.0.2 (#28354)
mjankowski Dec 14, 2023
adbfd40
Convert `api/v1/directories` controller spec to request spec (#28356)
mjankowski Dec 14, 2023
ef9797a
Un-nest contexts in `settings/2fa/webauthn` spec (#28359)
mjankowski Dec 14, 2023
1c3b5f4
Fix reference to non-existent var in CLI maintenance command (#28363)
mjankowski Dec 14, 2023
e17faed
Move default `meta` options from `InitialStateSerializer` to private …
mjankowski Dec 14, 2023
db897ea
Unwind `map` on single-item array in `spec/services/delete_account_se…
mjankowski Dec 14, 2023
1ee8d1e
Assign a proc to `Rack::Request.ip_filter` instead of patching method…
mjankowski Dec 15, 2023
e5717c9
Fix `Style/Lambda` cop (#28378)
mjankowski Dec 15, 2023
3e336fe
Opt out of `Rails/SkipsModelValidations` cop in db/migrate (#28371)
mjankowski Dec 15, 2023
b1dec09
Fix `Style/InverseMethods` cop (#28377)
mjankowski Dec 15, 2023
f99e057
New Crowdin Translations (automated) (#28373)
github-actions[bot] Dec 18, 2023
d099cf6
Update eslint (non-major) (#28408)
renovate[bot] Dec 18, 2023
287384b
Update DefinitelyTyped types (non-major) (#28407)
renovate[bot] Dec 18, 2023
43f637c
Update dependency rubocop-rails to v2.23.0 (#28396)
renovate[bot] Dec 18, 2023
fad7dca
Update dependency prom-client to v15.1.0 (#28394)
renovate[bot] Dec 18, 2023
fc4eaa7
Update dependency cssnano to v6.0.2 (#28382)
renovate[bot] Dec 18, 2023
e56fb9e
Fix `Style/SymbolProc` cop (#28386)
mjankowski Dec 18, 2023
89d468a
Fix `Style/StderrPuts` cop (#28389)
mjankowski Dec 18, 2023
0e5b8fc
Fix `Style/RedundantReturn` cop (#28391)
mjankowski Dec 18, 2023
8e9e7d5
Opt out of `Rails/UnusedIgnoredColumns` cop (#28385)
mjankowski Dec 18, 2023
2bd8d34
Fix `Style/SoleNestedConditional` and `Style/IfInsideElse` cops, rege…
mjankowski Dec 18, 2023
1820bad
Fix `Performance/StringIdentifierArgument` cop (#28399)
mjankowski Dec 18, 2023
0b42cf2
Opt out of `Rails/NegateInclude` cop (#28370)
mjankowski Dec 18, 2023
b2ca71f
Update dependency rubocop-performance to v1.20.0 (#28395)
renovate[bot] Dec 18, 2023
af366f6
Add spec coverage for `models/form/custom_emoji_batch` class (#28388)
mjankowski Dec 18, 2023
f4b9c2b
Group artifact actions (#28413)
ykzts Dec 18, 2023
7d9b209
Fix call to inefficient `delete_matched` cache method in domain block…
ClearlyClaire Dec 18, 2023
ab1201c
Update dependency regenerator-runtime to v0.14.1 (#28393)
renovate[bot] Dec 18, 2023
476d123
Typo fix in json ld helper spec (#28417)
mjankowski Dec 18, 2023
7cfc078
Fix rails mailer preview not honouring locale (#28418)
mjankowski Dec 18, 2023
8b1eeb2
Fix the loading bar with the new Redux actions (#28422)
renchap Dec 18, 2023
3598c2e
Revert "Feature - Prevents multiple audio/video attachments from bein…
ClearlyClaire Dec 19, 2023
fa987db
New Crowdin Translations (automated) (#28423)
github-actions[bot] Dec 19, 2023
7b1d390
Fixes dropdown target without a `buttonRef` (edit history) (#28427)
renchap Dec 19, 2023
c28976d
Handle negative offset param in `api/v2/search` (#28282)
mjankowski Dec 19, 2023
b7bdcd4
Update dependency @material-symbols/svg-600 to v0.14.3 (#28276)
renovate[bot] Dec 19, 2023
b5ac61b
Change algorithm of follow recommendations (#28314)
Gargron Dec 19, 2023
4075b4d
Update dependency node to 20.10 (#28040)
renovate[bot] Dec 19, 2023
5489d4c
Update dependency aws-sdk-s3 to v1.141.0 (#28116)
renovate[bot] Dec 19, 2023
c7c7279
Add spec for `CLI::Maintenance#fix_duplicates` (#28326)
mjankowski Dec 19, 2023
6fed0fc
Remove unneeded settings cleanup from specs (#28425)
ClearlyClaire Dec 19, 2023
961d65a
Add coverage to CLI Maintenance for duplicate users on `confirmation_…
mjankowski Dec 20, 2023
9a24b12
Update dependency sass-loader to v10.5.1 (#28432)
renovate[bot] Dec 20, 2023
fecc078
New Crowdin Translations (automated) (#28439)
github-actions[bot] Dec 20, 2023
ac04e62
Remove unused route definitions (#28430)
ClearlyClaire Dec 20, 2023
d29b1cc
Fix `friends_of_friends` sometimes suggesting already-followed accoun…
ClearlyClaire Dec 20, 2023
a6b57e3
Merge remote-tracking branch 'parent/main' into upstream-20231221
kmycode Dec 20, 2023
dbbd12e
Fix test
kmycode Dec 21, 2023
4d0ed70
Fix test
kmycode Dec 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@
matchUpdateTypes: ['patch', 'minor'],
groupName: 'eslint (non-major)',
},
{
// Group actions/*-artifact in the same PR
matchManagers: ['github-actions'],
matchPackageNames: [
'actions/download-artifact',
'actions/upload-artifact',
],
matchUpdateTypes: ['major'],
groupName: 'artifact actions (major)',
},
{
// Update @types/* packages every week, with one grouped PR
matchPackagePrefixes: '@types/',
Expand Down
14 changes: 3 additions & 11 deletions .haml-lint_todo.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
# This configuration was generated by
# `haml-lint --auto-gen-config`
# on 2023-10-26 09:32:34 -0400 using Haml-Lint version 0.51.0.
# on 2023-12-15 11:02:19 -0500 using Haml-Lint version 0.52.0.
# The point is for the user to remove these configuration records
# one by one as the lints are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of Haml-Lint, may require this file to be generated again.

linters:
# Offense count: 16
# Offense count: 11
LineLength:
exclude:
- 'app/views/admin/account_actions/new.html.haml'
- 'app/views/admin/accounts/index.html.haml'
- 'app/views/admin/ip_blocks/new.html.haml'
- 'app/views/admin/roles/_form.html.haml'
- 'app/views/admin/settings/discovery/show.html.haml'
- 'app/views/auth/registrations/edit.html.haml'
- 'app/views/auth/registrations/new.html.haml'
- 'app/views/filters/_filter_fields.html.haml'
- 'app/views/media/player.html.haml'
- 'app/views/settings/applications/_fields.html.haml'
- 'app/views/settings/imports/index.html.haml'
- 'app/views/settings/preferences/appearance/show.html.haml'
- 'app/views/settings/preferences/notifications/show.html.haml'
- 'app/views/settings/preferences/other/show.html.haml'
- 'app/views/settings/preferences/reaching/show.html.haml'
- 'app/views/settings/profiles/show.html.haml'
- 'app/views/settings/privacy_extra/show.html.haml'
- 'app/views/settings/profiles/show.html.haml'

# Offense count: 9
RuboCop:
exclude:
- 'app/views/admin/accounts/_buttons.html.haml'
- 'app/views/admin/accounts/_local_account.html.haml'
- 'app/views/admin/roles/_form.html.haml'
- 'app/views/home/index.html.haml'

ViewLength:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.9
20.10
15 changes: 15 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,21 @@ Rails/Exit:
- 'config/boot.rb'
- 'lib/mastodon/cli/*.rb'

Rails/SkipsModelValidations:
Exclude:
- 'db/*migrate/**/*'

# Reason: We want to preserve the ability to migrate from arbitrary old versions,
# and cannot guarantee that every installation has run every migration as they upgrade.
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsunusedignoredcolumns
Rails/UnusedIgnoredColumns:
Enabled: false

# Reason: Prevailing style choice
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsnegateinclude
Rails/NegateInclude:
Enabled: false

# Reason: Some single letter camel case files shouldn't be split
# https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecfilepath
RSpec/FilePath:
Expand Down
85 changes: 1 addition & 84 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Lint/NonLocalExitFromIterator:

# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 125
Max: 100

# Configuration parameters: CountBlocks, Max.
Metrics/BlockNesting:
Expand Down Expand Up @@ -121,23 +121,6 @@ Rails/LexicallyScopedActionFilter:
- 'app/controllers/auth/passwords_controller.rb'
- 'app/controllers/auth/registrations_controller.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
Rails/NegateInclude:
Exclude:
- 'app/controllers/concerns/signature_verification.rb'
- 'app/helpers/jsonld_helper.rb'
- 'app/lib/activitypub/activity/create.rb'
- 'app/lib/activitypub/activity/move.rb'
- 'app/lib/feed_manager.rb'
- 'app/lib/link_details_extractor.rb'
- 'app/models/concerns/attachmentable.rb'
- 'app/models/concerns/remotable.rb'
- 'app/models/custom_filter.rb'
- 'app/services/activitypub/process_status_update_service.rb'
- 'app/services/fetch_link_card_service.rb'
- 'app/workers/web/push_notification_worker.rb'
- 'lib/paperclip/color_extractor.rb'

Rails/OutputSafety:
Exclude:
- 'config/initializers/simple_form.rb'
Expand Down Expand Up @@ -183,22 +166,6 @@ Rails/SkipsModelValidations:
- 'app/workers/move_worker.rb'
- 'app/workers/scheduler/ip_cleanup_scheduler.rb'
- 'app/workers/scheduler/scheduled_statuses_scheduler.rb'
- 'db/migrate/20161203164520_add_from_account_id_to_notifications.rb'
- 'db/migrate/20170105224407_add_shortcode_to_media_attachments.rb'
- 'db/migrate/20170209184350_add_reply_to_statuses.rb'
- 'db/migrate/20170304202101_add_type_to_media_attachments.rb'
- 'db/migrate/20180528141303_fix_accounts_unique_index.rb'
- 'db/migrate/20180609104432_migrate_web_push_subscriptions2.rb'
- 'db/migrate/20181207011115_downcase_custom_emoji_domains.rb'
- 'db/migrate/20190511134027_add_silenced_at_suspended_at_to_accounts.rb'
- 'db/migrate/20191007013357_update_pt_locales.rb'
- 'db/migrate/20220316233212_update_kurdish_locales.rb'
- 'db/post_migrate/20190511152737_remove_suspended_silenced_account_fields.rb'
- 'db/post_migrate/20200917193528_migrate_notifications_type.rb'
- 'db/post_migrate/20201017234926_fill_account_suspension_origin.rb'
- 'db/post_migrate/20220617202502_migrate_roles.rb'
- 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb'
- 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb'
- 'lib/mastodon/cli/accounts.rb'
- 'lib/mastodon/cli/maintenance.rb'
- 'spec/lib/activitypub/activity/follow_spec.rb'
Expand All @@ -214,19 +181,6 @@ Rails/UniqueValidationWithoutIndex:
- 'app/models/identity.rb'
- 'app/models/webauthn_credential.rb'

# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/UnusedIgnoredColumns:
Exclude:
- 'app/models/account.rb'
- 'app/models/account_stat.rb'
- 'app/models/admin/action_log.rb'
- 'app/models/custom_filter.rb'
- 'app/models/email_domain_block.rb'
- 'app/models/report.rb'
- 'app/models/status_edit.rb'
- 'app/models/user.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: exists, where
Expand Down Expand Up @@ -380,22 +334,6 @@ Style/IfUnlessModifier:
- 'config/initializers/devise.rb'
- 'config/initializers/ffmpeg.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: InverseMethods, InverseBlocks.
Style/InverseMethods:
Exclude:
- 'app/models/custom_filter.rb'
- 'app/services/update_account_service.rb'
- 'spec/controllers/activitypub/replies_controller_spec.rb'

# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: line_count_dependent, lambda, literal
Style/Lambda:
Exclude:
- 'config/initializers/simple_form.rb'
- 'config/routes.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
Style/MapToHash:
Exclude:
Expand Down Expand Up @@ -460,15 +398,6 @@ Style/RedundantFetchBlock:
- 'config/initializers/paperclip.rb'
- 'config/puma.rb'

# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn:
Exclude:
- 'app/controllers/api/v1/directories_controller.rb'
- 'app/controllers/auth/confirmations_controller.rb'
- 'app/lib/ostatus/tag_manager.rb'
- 'app/models/form/import.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
# AllowedMethods: present?, blank?, presence, try, try!
Expand All @@ -489,11 +418,6 @@ Style/SingleArgumentDig:
Exclude:
- 'lib/webpacker/manifest_extensions.rb'

# This cop supports safe autocorrection (--autocorrect).
Style/StderrPuts:
Exclude:
- 'config/boot.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Expand All @@ -513,13 +437,6 @@ Style/StringLiterals:
- 'config/routes.rb'
- 'db/schema.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
# AllowedMethods: define_method, mail, respond_to
Style/SymbolProc:
Exclude:
- 'config/initializers/3_omniauth.rb'

# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
Expand Down
32 changes: 16 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,20 @@ GEM
attr_required (1.0.1)
awrence (1.2.1)
aws-eventstream (1.3.0)
aws-partitions (1.857.0)
aws-sdk-core (3.188.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (1.860.0)
aws-sdk-core (3.189.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.73.0)
aws-sdk-kms (1.74.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.140.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sdk-s3 (1.141.0)
aws-sdk-core (~> 3, >= 3.189.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.6)
aws-sigv4 (1.7.0)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
azure-storage-blob (2.0.3)
azure-storage-common (~> 2.0)
Expand All @@ -168,7 +168,7 @@ GEM
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bigdecimal (3.1.4)
bigdecimal (3.1.5)
bindata (2.4.15)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
Expand Down Expand Up @@ -197,7 +197,7 @@ GEM
activesupport
cbor (0.5.9.6)
charlock_holmes (0.7.7)
chewy (7.3.5)
chewy (7.4.0)
activesupport (>= 5.2)
elasticsearch (>= 7.12.0, < 7.14.0)
elasticsearch-dsl
Expand Down Expand Up @@ -515,7 +515,7 @@ GEM
openssl (> 2.0)
orm_adapter (0.5.0)
ox (2.14.17)
parallel (1.23.0)
parallel (1.24.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
Expand Down Expand Up @@ -681,10 +681,10 @@ GEM
rubocop (~> 1.41)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.22.2)
rubocop-performance (1.20.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.23.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/follow_recommendations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def show
authorize :follow_recommendation, :show?

@form = Form::AccountBatch.new
@accounts = filtered_follow_recommendations
@accounts = filtered_follow_recommendations.page(params[:page])
end

def update
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def require_not_suspended!
render json: { error: 'Your login is currently disabled' }, status: 403 if current_user&.account&.unavailable?
end

def require_valid_pagination_options!
render json: { error: 'Pagination values for `offset` and `limit` must be positive' }, status: 400 if pagination_options_invalid?
end

def require_user!
if !current_user
render json: { error: 'This method requires an authenticated user' }, status: 422
Expand Down Expand Up @@ -136,6 +140,10 @@ def disallow_unauthenticated_api_access?

private

def pagination_options_invalid?
params.slice(:limit, :offset).values.map(&:to_i).any?(&:negative?)
end

def respond_with_error(code)
render json: { error: Rack::Utils::HTTP_STATUS_CODES[code] }, status: code
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/accounts/notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ def set_account
end

def relationships_presenter
AccountRelationshipsPresenter.new([@account.id], current_user.account_id)
AccountRelationshipsPresenter.new([@account], current_user.account_id)
end
end
2 changes: 1 addition & 1 deletion app/controllers/api/v1/accounts/pins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ def set_account
end

def relationships_presenter
AccountRelationshipsPresenter.new([@account.id], current_user.account_id)
AccountRelationshipsPresenter.new([@account], current_user.account_id)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Api::V1::Accounts::RelationshipsController < Api::BaseController
before_action :require_user!

def index
@accounts = Account.where(id: account_ids).select('id')
@accounts = Account.where(id: account_ids).select(:id, :domain)
@accounts.merge!(Account.without_suspended) unless truthy_param?(:with_suspended)
render json: @accounts, each_serializer: REST::RelationshipSerializer, relationships: relationships
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def check_account_confirmation
end

def relationships(**options)
AccountRelationshipsPresenter.new([@account.id], current_user.account_id, **options)
AccountRelationshipsPresenter.new([@account], current_user.account_id, **options)
end

def account_params
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/directories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def show
private

def require_enabled!
return not_found unless Setting.profile_directory
not_found unless Setting.profile_directory
end

def set_accounts
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api/v1/follow_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def reject
private

def account
Account.find(params[:id])
@account ||= Account.find(params[:id])
end

def relationships(**options)
AccountRelationshipsPresenter.new([params[:id]], current_user.account_id, **options)
AccountRelationshipsPresenter.new([account], current_user.account_id, **options)
end

def load_accounts
Expand Down
Loading
Loading