discourse/plugins
Loïc Guitaut 584424594e DEV: Replace `params` by the contract object in services
This patch replaces the parameters provided to a service through
`params` by the contract object.

That way, it allows better consistency when accessing input params. For
example, if you have a service without a contract, to access a
parameter, you need to use `params[:my_parameter]`. But with a contract,
you do this through `contract.my_parameter`. Now, with this patch,
you’ll be able to access it through `params.my_parameter` or
`params[:my_parameter]`.

Some methods have been added to the contract object to better mimic a
Hash. That way, when accessing/using `params`, you don’t have to think
too much about it:
- `params.my_key` is also accessible through `params[:my_key]`.
- `params.my_key = value` can also be done through `params[:my_key] =
  value`.
- `#slice` and `#merge` are available.
- `#to_hash` has been implemented, so the contract object will be
  automatically cast as a hash by Ruby depending on the context. For
  example, with an AR model, you can do this: `user.update(**params)`.
2024-10-25 14:48:34 +02:00
..
automation DEV: Remove extraneous spec code (#29386) 2024-10-24 14:15:32 +02:00
chat DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
checklist DEV: remap all core icons for fontawesome 6 upgrade (#28715) 2024-09-13 16:50:52 +01:00
discourse-details FIX: allows to use open attribute with details (#29116) 2024-10-08 11:13:44 +09:00
discourse-lazy-videos Update translations (#28577) 2024-08-29 15:37:52 -04:00
discourse-local-dates DEV: Convert more test assertions to qunit-dom (#29214) 2024-10-15 17:11:20 +02:00
discourse-narrative-bot Update translations (#29212) 2024-10-16 17:52:01 +09:00
discourse-presence Revert "DEV: Refactor composer-/topic-presence-display (#29262)" (#29368) 2024-10-23 16:26:08 +02:00
footnote UX: fix footnote causing horizontal scroll on narrow screens (#29328) 2024-10-22 05:09:34 +02:00
poll DEV: Update more asserts to qunit-dom (#29326) 2024-10-22 11:34:23 +02:00
spoiler-alert DEV: Convert more test assertions to qunit-dom (#29214) 2024-10-15 17:11:20 +02:00
styleguide Update translations 2024-10-02 08:55:44 +02:00