following

This commit is contained in:
Joffrey JAFFEUX 2023-11-08 20:10:31 +01:00
parent 015b4e2c0c
commit d1550dc71f

View File

@ -223,6 +223,15 @@ module Chat
)
end
if options.key?(:following)
following_params = { user_id: user_id }
following_params[:following] = options[:following] if options[:following].present?
query =
query.joins(:user_chat_channel_memberships).where(
user_chat_channel_memberships: following_params,
)
end
query =
query.order("last_message.created_at DESC NULLS LAST").group(
"chat_channels.id",