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:
@@ -20,6 +20,7 @@ defmodule Mobilizon.GraphQL.Schema.ConversationType do
|
||||
)
|
||||
|
||||
field(:last_comment, :comment, description: "The last comment of the conversation")
|
||||
field(:origin_comment, :comment, description: "The first comment of the conversation")
|
||||
|
||||
field :comments, :paginated_comment_list do
|
||||
arg(:page, :integer, default_value: 1)
|
||||
|
||||
@@ -47,6 +47,12 @@ defmodule Mobilizon.GraphQL.Schema.Discussions.CommentType do
|
||||
|
||||
field(:threadLanguages, non_null(list_of(:string)), description: "The thread languages")
|
||||
field(:actor, :person, resolve: dataloader(Actors), description: "The comment's author")
|
||||
|
||||
field(:attributed_to, :actor,
|
||||
resolve: dataloader(Actors),
|
||||
description: "The comment's attributed to actor"
|
||||
)
|
||||
|
||||
field(:inserted_at, :datetime, description: "When was the comment inserted in database")
|
||||
field(:updated_at, :datetime, description: "When was the comment updated")
|
||||
field(:deleted_at, :datetime, description: "When was the comment deleted")
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user