discourse/app/controllers/admin
Loïc Guitaut 41584ab40c DEV: Provide user input to services using params key
Currently in services, we don’t make a distinction between input
parameters, options and dependencies.

This can lead to user input modifying the service behavior, whereas it
was not the developer intention.

This patch addresses the issue by changing how data is provided to
services:
- `params` is now used to hold all data coming from outside (typically
  user input from a controller) and a contract will take its values from
  `params`.
- `options` is a new key to provide options to a service. This typically
  allows changing a service behavior at runtime. It is, of course,
  totally optional.
- `dependencies` is actually anything else provided to the service (like
  `guardian`) and available directly from the context object.

The `service_params` helper in controllers has been updated to reflect
those changes, so most of the existing services didn’t need specific
changes.

The options block has the same DSL as contracts, as it’s also based on
`ActiveModel`. There aren’t any validations, though. Here’s an example:
```ruby
options do
  attribute :allow_changing_hidden, :boolean, default: false
end
```
And here’s an example of how to call a service with the new keys:
```ruby
MyService.call(params: { key1: value1, … }, options: { my_option: true }, guardian:, …)
```
2024-10-25 09:57:59 +02:00
..
config DEV: Provide user input to services using params key 2024-10-25 09:57:59 +02:00
admin_controller.rb DEV: Drop WithServiceHelper 2024-09-05 09:58:20 +02:00
admin_notices_controller.rb DEV: Make params explicit for services in controllers 2024-10-03 16:56:39 +09:00
api_controller.rb PERF: introduce a basic api key serializer 2024-04-24 19:16:10 +02:00
backups_controller.rb SECURITY: Rate limit the creation of backups 2023-03-16 16:09:22 +01:00
badges_controller.rb UX: Easily toggle badges in admin badge list (#20225) 2023-02-09 11:36:27 -08:00
color_schemes_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
dashboard_controller.rb FEATURE: allow admins to enable announced experimental features (#29244) 2024-10-22 10:56:58 +11:00
email_controller.rb FEAT: add cc addresses and post_id to sent email logs (#25014) 2024-01-03 09:27:25 +08:00
email_styles_controller.rb FEATURE: customization of html emails (#7934) 2019-07-30 15:05:08 -04:00
email_templates_controller.rb FIX: Add new/missing email templates to the email templates editor (#28075) 2024-07-30 00:27:41 +03:00
embeddable_hosts_controller.rb FEATURE: Extend embeddable hosts with Individual tags and author assignments (#26868) 2024-05-16 15:47:01 -04:00
embedding_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
emojis_controller.rb FEATURE: Add creator and logging for CustomEmoji (#28004) 2024-07-22 14:44:49 +08:00
form_templates_controller.rb DEV: Show form templates in the composer (#21190) 2023-05-29 14:47:18 -07:00
groups_controller.rb DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
impersonate_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
permalinks_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
plugins_controller.rb FIX: Don't allow access to plugin page if plugin is not visible (#26431) 2024-04-02 16:26:15 +03:00
reports_controller.rb FEATURE: Revive legacy pageview reports (#29308) 2024-10-22 10:06:22 +10:00
robots_txt_controller.rb FIX: Show true content of robots.txt after restoring to default (#24980) 2023-12-20 23:00:37 +03:00
screened_emails_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
screened_ip_addresses_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
screened_urls_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
search_logs_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
section_controller.rb DEV: Add a skeleton for section landing page & items (#28477) 2024-10-02 12:19:38 +10:00
site_settings_controller.rb DEV: Provide user input to services using params key 2024-10-25 09:57:59 +02:00
site_texts_controller.rb FEATURE: Allow showing site text search in selected locale (#28453) 2024-08-26 11:25:36 +10:00
staff_action_logs_controller.rb FEATURE: Log tag group changes in staff action log (#28787) 2024-09-09 10:50:48 +08:00
staff_controller.rb DEV: Drop WithServiceHelper 2024-09-05 09:58:20 +02:00
themes_controller.rb DEV: Remove logical OR assignment of constants (#29201) 2024-10-16 10:09:07 +08:00
user_fields_controller.rb FEATURE: Implement new required options in admin user fields UI (#27079) 2024-05-23 19:18:25 +08:00
users_controller.rb DEV: Stop injecting a service result object in the caller object 2024-10-22 16:58:54 +02:00
versions_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
watched_words_controller.rb FEATURE: add HTML replacements 2024-05-14 10:41:27 +02:00
web_hooks_controller.rb FEATURE: Add Mechanism to redeliver all failed webhook events (#27609) 2024-07-08 15:43:16 -05:00