mastodon/app/views
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
..
about Fix titles being escaped twice (#32889) 2024-11-14 13:28:00 +00:00
accounts Fix titles being escaped twice (#32889) 2024-11-14 13:28:00 +00:00
admin Extract form batch classes for relationships and follow recommendations 2025-08-25 10:31:37 -04:00
admin_mailer Change hashtag trends to be stored in the database instead of redis (#32837) 2024-12-04 11:59:17 +00:00
application Add helpers for ios/android app store links in welcome mailer (#33475) 2025-01-06 19:59:11 +00:00
auth Update age limit wording (#35387) 2025-07-15 15:46:44 +00:00
custom_css Remove role color highlighting from custom css (#33493) 2025-01-07 16:28:35 +00:00
disputes/strikes Include time portion in formatted datetimes when provided (#33191) 2025-01-08 14:26:08 +00:00
errors Use existing config access to local_domain value (#30509) 2024-06-03 09:15:58 +00:00
filters Add new filter action to blur media (#34256) 2025-03-26 07:31:05 +00:00
follower_accounts Change public accounts pages to mount the web UI (#19319) 2022-10-20 14:35:29 +02:00
following_accounts Change public accounts pages to mount the web UI (#19319) 2022-10-20 14:35:29 +02:00
home Change public accounts pages to mount the web UI (#19319) 2022-10-20 14:35:29 +02:00
invites Fix missing button styles on some forms (#33771) 2025-01-29 10:36:24 +00:00
kaminari Migrate fontawesome->material in more views (#31360) 2024-08-20 11:52:45 +00:00
layouts Add crossorigin back to inert css (regression? of #30687) (#35876) 2025-08-25 06:54:47 +00:00
mail_subscriptions Fix missing button styles on some forms (#33771) 2025-01-29 10:36:24 +00:00
media Convert from Webpack to Vite (#34450) 2025-05-16 13:26:12 +00:00
notification_mailer Change icon of quote notification mails (#35701) 2025-08-06 15:20:16 +00:00
oauth Fix missing button styles on some forms (#33771) 2025-01-29 10:36:24 +00:00
privacy Fix titles being escaped twice (#32889) 2024-11-14 13:28:00 +00:00
redirects Change referrer policy to be controlled by header in web UI (#33214) 2024-12-09 22:42:45 +00:00
relationships Extract form batch classes for relationships and follow recommendations 2025-08-25 10:31:37 -04:00
remote_interaction_helper Convert from Webpack to Vite (#34450) 2025-05-16 13:26:12 +00:00
settings Add missing mailer for quote notifications (#35652) 2025-08-04 10:44:59 +00:00
severed_relationships Wrap datetime in time element with attrs (#32177) 2024-10-01 12:45:58 +00:00
shared Use config_for for VAPID key storage (#34845) 2025-05-30 07:00:33 +00:00
shares Convert from Webpack to Vite (#34450) 2025-05-16 13:26:12 +00:00
statuses Expose status language via og:locale (#34012) 2025-02-28 10:53:39 +00:00
statuses_cleanup Disable irrelevant fields unless cleanup is enabled (#26562) 2024-08-04 08:57:46 +00:00
tags Add rel alternate rss/json links to tags show html page (#33179) 2024-12-05 11:34:49 +00:00
terms_of_service Add terms of service (#33055) 2024-12-09 10:04:46 +00:00
terms_of_service_interstitial Add interstitial for Terms of Service updates (#34527) 2025-05-16 14:03:05 +00:00
user_mailer Remove broken link to /start/share in welcome e-mail (#34962) 2025-06-08 13:58:53 +00:00
well_known/host_meta Rubocop fix: Perfomance/UnfreezeString (#26217) 2023-07-28 23:11:05 +02:00