mobilizon.chapril.org-mobil.../lib/graphql/api/comments.ex
Thomas Citharel 4144e9ffd0
Introduce group basic federation, event new page and notifications
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2020-06-03 16:01:26 +02:00

35 lines
801 B
Elixir

defmodule Mobilizon.GraphQL.API.Comments do
@moduledoc """
API for Comments.
"""
alias Mobilizon.Conversations.Comment
alias Mobilizon.Federation.ActivityPub
alias Mobilizon.Federation.ActivityPub.Activity
@doc """
Create a comment
Creates a comment from an actor
"""
@spec create_comment(map) :: {:ok, Activity.t(), Comment.t()} | any
def create_comment(args) do
ActivityPub.create(:comment, args, true)
end
def update_comment(%Comment{} = comment, args) do
ActivityPub.update(:comment, comment, args, true)
end
@doc """
Deletes a comment
Deletes a comment from an actor
"""
@spec delete_comment(Comment.t()) :: {:ok, Activity.t(), Comment.t()} | any
def delete_comment(%Comment{} = comment) do
ActivityPub.delete(comment, true)
end
end