Refactor adding tags to an event
Also refactor extracting tags from content, now uses Pleroma's Formatter Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -6,10 +6,9 @@ defmodule MobilizonWeb.API.Comments do
|
||||
alias Mobilizon.Actors
|
||||
alias Mobilizon.Actors.Actor
|
||||
alias Mobilizon.Events.Comment
|
||||
alias Mobilizon.Service.Formatter
|
||||
alias Mobilizon.Service.ActivityPub
|
||||
alias Mobilizon.Service.ActivityPub.Utils, as: ActivityPubUtils
|
||||
import MobilizonWeb.API.Utils
|
||||
alias MobilizonWeb.API.Utils
|
||||
|
||||
@doc """
|
||||
Create a comment
|
||||
@@ -20,23 +19,14 @@ defmodule MobilizonWeb.API.Comments do
|
||||
def create_comment(
|
||||
from_username,
|
||||
status,
|
||||
visibility \\ "public",
|
||||
visibility \\ :public,
|
||||
in_reply_to_comment_URL \\ nil
|
||||
) do
|
||||
with {:local_actor, %Actor{url: url} = actor} <-
|
||||
{:local_actor, Actors.get_local_actor_by_name(from_username)},
|
||||
status <- String.trim(status),
|
||||
mentions <- Formatter.parse_mentions(status),
|
||||
in_reply_to_comment <- get_in_reply_to_comment(in_reply_to_comment_URL),
|
||||
{to, cc} <- to_for_actor_and_mentions(actor, mentions, in_reply_to_comment, visibility),
|
||||
tags <- Formatter.parse_tags(status),
|
||||
content_html <-
|
||||
make_content_html(
|
||||
status,
|
||||
mentions,
|
||||
tags,
|
||||
"text/plain"
|
||||
),
|
||||
{content_html, tags, to, cc} <-
|
||||
Utils.prepare_content(actor, status, visibility, [], in_reply_to_comment),
|
||||
comment <-
|
||||
ActivityPubUtils.make_comment_data(
|
||||
url,
|
||||
|
||||
Reference in New Issue
Block a user