1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-27 10:19:59 +00:00
mobilizon/lib/mobilizon_web/api/comments.ex
Thomas Citharel dc07f34d78
Introduce comments below events
Also add tomstones

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2019-11-28 12:33:58 +01:00

30 lines
694 B
Elixir

defmodule MobilizonWeb.API.Comments do
@moduledoc """
API for Comments.
"""
alias Mobilizon.Events.Comment
alias Mobilizon.Service.ActivityPub
alias Mobilizon.Service.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
@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