aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api/common_api.ex
diff options
context:
space:
mode:
authorEgor <egor@kislitsyn.com>2019-02-26 23:32:26 +0000
committerkaniini <nenolod@gmail.com>2019-02-26 23:32:26 +0000
commitc3ac9424d2affe87df82c14dc243f507fa639343 (patch)
tree00170ceac7432de10e7fb7d6a5b6b4e3a0147281 /lib/pleroma/web/common_api/common_api.ex
parente9703a53265d38302d5659752c8068b5ef4a021f (diff)
downloadpleroma-c3ac9424d2affe87df82c14dc243f507fa639343.tar.gz
AutoLinker
Diffstat (limited to 'lib/pleroma/web/common_api/common_api.ex')
-rw-r--r--lib/pleroma/web/common_api/common_api.ex28
1 files changed, 4 insertions, 24 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex
index e788337cc..7114d6de6 100644
--- a/lib/pleroma/web/common_api/common_api.ex
+++ b/lib/pleroma/web/common_api/common_api.ex
@@ -82,40 +82,20 @@ defmodule Pleroma.Web.CommonAPI do
def get_visibility(_), do: "public"
- defp get_content_type(content_type) do
- if Enum.member?(Pleroma.Config.get([:instance, :allowed_post_formats]), content_type) do
- content_type
- else
- "text/plain"
- end
- end
-
def post(user, %{"status" => status} = data) do
visibility = get_visibility(data)
limit = Pleroma.Config.get([:instance, :limit])
with status <- String.trim(status),
attachments <- attachments_from_ids(data),
- mentions <- Formatter.parse_mentions(status),
inReplyTo <- get_replied_to_activity(data["in_reply_to_status_id"]),
- {to, cc} <- to_for_user_and_mentions(user, mentions, inReplyTo, visibility),
- tags <- Formatter.parse_tags(status, data),
- content_html <-
+ {content_html, mentions, tags} <-
make_content_html(
status,
- mentions,
attachments,
- tags,
- get_content_type(data["content_type"]),
- Enum.member?(
- [true, "true"],
- Map.get(
- data,
- "no_attachment_links",
- Pleroma.Config.get([:instance, :no_attachment_links], false)
- )
- )
+ data
),
+ {to, cc} <- to_for_user_and_mentions(user, mentions, inReplyTo, visibility),
context <- make_context(inReplyTo),
cw <- data["spoiler_text"],
full_payload <- String.trim(status <> (data["spoiler_text"] || "")),
@@ -247,7 +227,7 @@ defmodule Pleroma.Web.CommonAPI do
def report(user, data) do
with {:account_id, %{"account_id" => account_id}} <- {:account_id, data},
{:account, %User{} = account} <- {:account, User.get_by_id(account_id)},
- {:ok, content_html} <- make_report_content_html(data["comment"]),
+ {:ok, {content_html, _, _}} <- make_report_content_html(data["comment"]),
{:ok, statuses} <- get_report_statuses(account, data),
{:ok, activity} <-
ActivityPub.flag(%{