discourse/plugins/chat/app/services/chat
Loïc Guitaut 9e9abe0a82 DEV: Unify params access in services
Currently, there are two ways (kind of) for accessing `params` inside a
service:
- when there is no contract or it hasn’t been reached yet, `params` is
  just the hash that was provided to the service. To access a key, you
  have to use the bracket notation `params[:my_key]`.
- when there is a contract and it has been executed successfully,
  `params` now references the contract and the attributes are accessible
  using methods (`params.my_key`).

This patch unifies how `params` exposes its attributes. Now, even if
there is no contract at all in a service, `params` will expose its
attributes through methods, that way things are more consistent.

This patch also makes sure there is always a `params` object available
even when no `params` key is provided to the service (this allows a
contract to fail because its attributes are blank instead of having the
service raising an error because it doesn’t find `params` in its context).
2024-12-13 11:13:18 +01:00
..
action PERF: auto join & leave chat channels (#29193) 2024-11-12 15:00:59 +11: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: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
auto_join_channels.rb PERF: auto join & leave chat channels (#29193) 2024-11-12 15:00:59 +11:00
auto_leave_channels.rb PERF: optimize chat user membership cleanup when removing a single user (#29833) 2024-11-20 09:21:02 +01:00
create_category_channel.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
create_direct_message_channel.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
create_message_interaction.rb DEV: adds blocks support to chat messages (#29782) 2024-11-19 07:07:58 +01:00
create_message.rb DEV: Unify params access in services 2024-12-13 11:13:18 +01:00
create_thread.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
flag_message.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
invite_users_to_channel.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
leave_channel.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
list_channel_messages.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
list_channel_thread_messages.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
list_user_channels.rb FIX: show chat thread notifications for direct message channels (#29414) 2024-10-31 10:50:11 +04:00
lookup_channel_threads.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
lookup_thread.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
lookup_user_threads.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01: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: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
message_destroyer.rb DEV: Add last_message_id to channel and thread (#22488) 2023-07-13 10:28:11 +10:00
publisher.rb PERF: auto join & leave chat channels (#29193) 2024-11-12 15:00:59 +11:00
restore_message.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
search_chatable.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
start_reply.rb DEV: start/stop reply implementation (#29542) 2024-11-04 08:14:35 +11:00
stop_message_streaming.rb DEV: Remove hash-like access from service contracts 2024-10-29 16:02:51 +01:00
stop_reply.rb DEV: start/stop reply implementation (#29542) 2024-11-04 08:14:35 +11:00
tracking_state.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
trash_channel.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
trash_message.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
trash_messages.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
unfollow_channel.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
update_channel_status.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
update_channel.rb DEV: Unify params access in services 2024-12-13 11:13:18 +01:00
update_message.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
update_thread_notification_settings.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
update_thread.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
update_user_channel_last_read.rb DEV: Remove hash-like access from service contracts 2024-10-29 16:02:51 +01:00
update_user_thread_last_read.rb DEV: Remove hash-like access from service contracts 2024-10-29 16:02:51 +01:00
upsert_draft.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00