discourse/plugins/chat/app/services/chat
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
..
action DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
auto_remove DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
channel/policy DEV: Introduce a `Service::ActionBase` class for service actions 2024-09-18 17:02:46 +02:00
direct_message_channel/policy DEV: Introduce a `Service::ActionBase` class for service actions 2024-09-18 17:02:46 +02:00
add_users_to_channel.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
auto_join_channel_batch.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
create_category_channel.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
create_direct_message_channel.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
create_message.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
create_thread.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
flag_message.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
invite_users_to_channel.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
leave_channel.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
list_channel_messages.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
list_channel_thread_messages.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
list_user_channels.rb DEV: Provide user input to services using `params` key 2024-10-25 09:57:59 +02:00
lookup_channel_threads.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
lookup_thread.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
lookup_user_threads.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
mark_all_user_channels_read.rb DEV: Provide user input to services using `params` key 2024-10-25 09:57:59 +02:00
mark_thread_title_prompt_seen.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
message_destroyer.rb DEV: Add last_message_id to channel and thread (#22488) 2023-07-13 10:28:11 +10:00
publisher.rb DEV: Provide user input to services using `params` key 2024-10-25 09:57:59 +02:00
restore_message.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
search_chatable.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
stop_message_streaming.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
tracking_state.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
trash_channel.rb DEV: Provide user input to services using `params` key 2024-10-25 09:57:59 +02:00
trash_message.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
trash_messages.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
unfollow_channel.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
update_channel.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
update_channel_status.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
update_message.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
update_thread.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
update_thread_notification_settings.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
update_user_channel_last_read.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
update_user_thread_last_read.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00
upsert_draft.rb DEV: Replace `params` by the contract object in services 2024-10-25 14:48:34 +02:00