discourse/plugins/chat/app/services/chat
Martin Brennan e92e05b22e
FIX: Error when leaving group DM channel (#31537)
Followup b5147a4634

When we aliased `leave` to `remove` and renamed
the method in `DirectMessageChannel` in the previous
commit, this inadvertantly caused an error when
unfollowing group channels in the channel list.

When clicking the X in the channel list, we hit
ChannelsCurrentUserMembershipFollowsController for the
current user and the channel, which is supposed to only
unfollow the channel for all channel types including DMs.

Group DMs have a different Leave behaviour vs Unfollow.
Leaving the channel altogether is done from the channel
settings page, the "Leave channel" button, and that
deletes the user's membership and DM user record from that
channel.

So, we were trying to do the leave channel behaviour in the
unfollow channel controller, which was returning the wrong
record for the serializer (a User not a Membership)

This fixes the issue and removes a bit of delegate/alias indirection
which was making the code a bit harder to fllow and search, even
though it was more succinct. Also adds missing specs that would
have caught this regression.
2025-02-27 14:26:07 +10:00
..
action PERF: auto join & leave chat channels (#29193) 2024-11-12 15:00:59 +11:00
channel/policy SECURITY: Ability to bypass disabling chat of users 2025-02-04 13:32:42 -03: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.rb DEV: Unify params access in services 2024-12-13 11:13:18 +01:00
create_message_interaction.rb DEV: adds blocks support to chat messages (#29782) 2024-11-19 07:07:58 +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 FIX: Error when leaving group DM channel (#31537) 2025-02-27 14:26:07 +10: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
remove_user_from_channel.rb FIX: Error when leaving group DM channel (#31537) 2025-02-27 14:26:07 +10: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 FIX: Error when leaving group DM channel (#31537) 2025-02-27 14:26:07 +10:00
update_channel.rb DEV: Unify params access in services 2024-12-13 11:13:18 +01:00
update_channel_status.rb DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
update_message.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_thread_notification_settings.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