Add support for GraphQL handling of group follows
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -17,6 +17,11 @@ defmodule Mobilizon.GraphQL.Schema.Actors.FollowerType do
|
||||
description: "Whether the follow has been approved by the target actor"
|
||||
)
|
||||
|
||||
field(:notify, :boolean,
|
||||
description:
|
||||
"Whether the follower will be notified by the target actor's activity or not (applicable for profile/group follows)"
|
||||
)
|
||||
|
||||
field(:inserted_at, :datetime, description: "When the follow was created")
|
||||
field(:updated_at, :datetime, description: "When the follow was updated")
|
||||
end
|
||||
|
||||
@@ -205,6 +205,12 @@ defmodule Mobilizon.GraphQL.Schema.Actors.GroupType do
|
||||
value(:private, description: "Visible only to people with the link - or invited")
|
||||
end
|
||||
|
||||
object :group_follow do
|
||||
field(:group, :group, description: "The group followed")
|
||||
field(:profile, :group, description: "The group followed")
|
||||
field(:notify, :boolean, description: "Whether to notify profile from group activity")
|
||||
end
|
||||
|
||||
object :group_queries do
|
||||
@desc "Get all groups"
|
||||
field :groups, :paginated_group_list do
|
||||
@@ -310,5 +316,36 @@ defmodule Mobilizon.GraphQL.Schema.Actors.GroupType do
|
||||
|
||||
resolve(&Group.delete_group/3)
|
||||
end
|
||||
|
||||
@desc "Follow a group"
|
||||
field :follow_group, :follower do
|
||||
arg(:group_id, non_null(:id), description: "The group ID")
|
||||
|
||||
arg(:notify, :boolean,
|
||||
description: "Whether to notify profile from group activity",
|
||||
default_value: true
|
||||
)
|
||||
|
||||
resolve(&Group.follow_group/3)
|
||||
end
|
||||
|
||||
@desc "Update a group follow"
|
||||
field :update_group_follow, :follower do
|
||||
arg(:follow_id, non_null(:id), description: "The follow ID")
|
||||
|
||||
arg(:notify, :boolean,
|
||||
description: "Whether to notify profile from group activity",
|
||||
default_value: true
|
||||
)
|
||||
|
||||
resolve(&Group.update_group_follow/3)
|
||||
end
|
||||
|
||||
@desc "Unfollow a group"
|
||||
field :unfollow_group, :follower do
|
||||
arg(:group_id, non_null(:id), description: "The group ID")
|
||||
|
||||
resolve(&Group.unfollow_group/3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user