fix(announcements): make sure only valid announcements are shown to the user

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2024-01-05 17:51:41 +01:00
parent dcbb8eae01
commit c9a1c35aa7
8 changed files with 95 additions and 4 deletions

View File

@@ -137,7 +137,7 @@ defmodule Mobilizon.Conversations do
subquery
|> subquery()
|> order_by([cp], desc: cp.unread, desc: cp.updated_at)
|> preload([:actor, conversation: [:last_comment, :participants]])
|> preload([:actor, conversation: [:last_comment, :origin_comment, :participants, :event]])
|> Page.build_page(page, limit)
end
@@ -151,7 +151,7 @@ defmodule Mobilizon.Conversations do
ConversationParticipant
|> join(:inner, [cp], a in Actor, on: cp.actor_id == a.id)
|> where([_cp, a], a.user_id == ^user_id)
|> preload([:actor, conversation: [:last_comment, :participants]])
|> preload([:actor, conversation: [:last_comment, :origin_comment, :participants, :event]])
|> Page.build_page(page, limit)
end