mastodon/spec/requests
Matt Jankowski 4fa462a9f8 Extract form batch classes for relationships and follow recommendations
Related to - https://github.com/mastodon/mastodon/pull/35458 - which added a batch base class, and to - https://github.com/mastodon/mastodon/pull/35872 - which envisions a world where form objects tell the view what to do.

Background here...

- The `Form::AccountBatch` form object is used in a few different places, for somewhat varied purposes
- The user relationships view uses it on a show page, which does a PUT to update, and uses the `follow`, `unfollow`, `remove_from_followers`, and `remove_domains_from_followers` "actions" of the form model
- The admin accounts view shows a form on index view, does POST to batch action, uses the `suspend`, `approve` and `reject` actions.
- The admin relationships view (for admins only) also has a form on index and does a POST back to that same spot
- The admin/follow_recommendations page has a form on show and does PUT to update, using the `suppress_follow_recommendation` and `unsuppress_follow_recommendation` actions

So, while these are all related in that they supply an `accounts_ids` array, the actual things that they "bulk update" are Follow (from relationships), FollowRecommendationSuppression (from follow recs) and Account (from accounts). This is a little inconsistent with other of the "batch form model" classes, which tend to update the same domain concept (ie, CustomEmojiBlock, IpBlockBatch, EmailDomainBlockBatch, etc) that they are named after (and in some cases that a "filter" class is named after).

All that said, the changes here:

- Pull out `Form::FollowRecommendationBatch` and `Form::RelationshipBatch` classes, which more closely align with the domain concept they are bulk updating (open to naming suggestions here)
- Mark both of these as `persisted?` true so that their form views will infer correct HTTP action
- Add some missing coverage to existing class, and coverage for new classes as well

It would be pretty straightforward to chop this up into smaller pieces, if any of "just the coverage first", "just the boolean attribute", "one new batch class at a time", etc - were more appealing.

Possible follow-up:

- In the existing `Form::AccountBatch`, use attributes API for boolean `select_all_matching` value, remove query method
- Convert the relationships controller spec to mix of request/system specs, round out coverage
- Most (all maybe?) of the "batch actions" are doing a `POST` to a `batch` action on the controller of whatever they are related to. Might be worth looking at what the diff would look like to move these all to nested controllers where they did a `PUT to */batches#update` with restful routing, etc.
2025-08-25 10:31:37 -04:00
..
activitypub Add support for local quote stamps (#35626) 2025-08-01 14:55:25 +00:00
admin Extract form batch classes for relationships and follow recommendations 2025-08-25 10:31:37 -04:00
api Fix updates to quote policy not being federated (#35804) 2025-08-18 08:34:45 +00:00
auth Merge commit from fork 2025-02-27 15:44:35 +01:00
disputes Convert disputes/strikes spec controller->request/system (#34191) 2025-03-18 08:18:36 +00:00
filters Convert filters/statuses spec controller->system/request (#34232) 2025-03-24 08:11:34 +00:00
oauth Update OAuth inflection to match spec (#35160) 2025-06-25 07:52:30 +00:00
settings Convert settings/pictures spec controller->request (#34340) 2025-04-02 12:58:47 +00:00
statuses Convert statuses#activity action controller to request spec (#33336) 2024-12-17 16:37:30 +00:00
well_known Move "limited federation mode" config to x.mastodon area (#35041) 2025-06-16 06:13:03 +00:00
account_show_page_spec.rb Use response.parsed_body for html response checks (#31750) 2024-09-04 17:29:05 +00:00
accounts_spec.rb Remove render_template from accounts request spec (#33519) 2025-01-09 08:17:11 +00:00
anonymous_cookies_spec.rb Enable "zero monkey patching" mode in RSpec (#31614) 2024-09-04 05:12:25 +00:00
backups_spec.rb Enable "zero monkey patching" mode in RSpec (#31614) 2024-09-04 05:12:25 +00:00
cache_spec.rb Move "limited federation mode" config to x.mastodon area (#35041) 2025-06-16 06:13:03 +00:00
catch_all_route_request_spec.rb Enable "zero monkey patching" mode in RSpec (#31614) 2024-09-04 05:12:25 +00:00
content_security_policy_spec.rb Reduce hard coding of LOCAL_DOMAIN env value throughout tests (#35025) 2025-06-13 07:58:22 +00:00
custom_css_spec.rb Extend custom CSS cache time with digest paths (#33207) 2025-01-08 08:48:45 +00:00
disabled_oauth_endpoints_spec.rb Enable "zero monkey patching" mode in RSpec (#31614) 2024-09-04 05:12:25 +00:00
emojis_spec.rb Remove body_as_json in favor of built-in response.parsed_body for JSON response specs (#31749) 2024-09-06 09:58:46 +00:00
filters_spec.rb Use expect for nested params in more controllers (#33675) 2025-01-22 08:35:34 +00:00
follower_accounts_spec.rb Adds new follower/following routes (#24601) 2023-04-30 09:01:42 +02:00
following_accounts_spec.rb Adds new follower/following routes (#24601) 2023-04-30 09:01:42 +02:00
health_spec.rb Enable "zero monkey patching" mode in RSpec (#31614) 2024-09-04 05:12:25 +00:00
instance_actor_spec.rb Move "limited federation mode" config to x.mastodon area (#35041) 2025-06-16 06:13:03 +00:00
intents_spec.rb Convert intents spec controller->request (#34261) 2025-03-25 09:07:22 +00:00
invite_spec.rb Add coverage for api/v1/invites scenarios (#35389) 2025-07-21 14:17:53 +00:00
invites_spec.rb Use expect for nested params in more controllers (#33675) 2025-01-22 08:35:34 +00:00
link_headers_spec.rb Reduce hard coding of LOCAL_DOMAIN env value throughout tests (#35025) 2025-06-13 07:58:22 +00:00
localization_spec.rb Enable "zero monkey patching" mode in RSpec (#31614) 2024-09-04 05:12:25 +00:00
log_out_spec.rb Remove body_as_json in favor of built-in response.parsed_body for JSON response specs (#31749) 2024-09-06 09:58:46 +00:00
mail_subscriptions_spec.rb Add List-Unsubscribe email header (#26085) 2023-08-01 19:34:40 +02:00
manifest_spec.rb Remove body_as_json in favor of built-in response.parsed_body for JSON response specs (#31749) 2024-09-06 09:58:46 +00:00
media_proxy_spec.rb Enable "zero monkey patching" mode in RSpec (#31614) 2024-09-04 05:12:25 +00:00
media_spec.rb Convert media controller spec to request spec (#31634) 2024-08-29 08:46:00 +00:00
omniauth_callbacks_spec.rb Use config_for for omniauth enabled values (#35015) 2025-06-24 09:32:13 +00:00
public_files_spec.rb Add specs for PublicFileServer middleware (#35219) 2025-06-30 11:23:11 +00:00
relationships_spec.rb Extract form batch classes for relationships and follow recommendations 2025-08-25 10:31:37 -04:00
remote_interaction_helper_spec.rb Reduce hard coding of LOCAL_DOMAIN env value throughout tests (#35025) 2025-06-13 07:58:22 +00:00
self_destruct_spec.rb Enable "zero monkey patching" mode in RSpec (#31614) 2024-09-04 05:12:25 +00:00
severed_relationships_spec.rb Add coverage for CSV responses for severed relationships (#31962) 2024-09-20 13:13:47 +00:00
signature_verification_spec.rb Better error response to malformed headers (#35278) 2025-07-08 09:31:04 +00:00
status_show_page_spec.rb Allow more flexible host/port treatment with LOCAL_DOMAIN values in tests (#35040) 2025-06-16 13:12:23 +00:00
statuses_cleanup_spec.rb Use expect for nested params in more controllers (#33675) 2025-01-22 08:35:34 +00:00
statuses_spec.rb Convert statuses spec controller->system/request (#33921) 2025-02-18 11:43:49 +00:00
tags_spec.rb Add rel alternate rss/json links to tags show html page (#33179) 2024-12-05 11:34:49 +00:00