Merge branch 'develop' into issue/1276

This commit is contained in:
Maksim Pechnikov 2020-02-13 20:43:34 +03:00
commit 6f9839c73c
8 changed files with 59 additions and 33 deletions

View file

@ -62,6 +62,6 @@ defmodule Pleroma.ActivityExpiration do
def expires_late_enough?(scheduled_at) do
now = NaiveDateTime.utc_now()
diff = NaiveDateTime.diff(scheduled_at, now, :millisecond)
diff >= @min_activity_lifetime
diff > @min_activity_lifetime
end
end

View file

@ -228,9 +228,9 @@ defmodule Pleroma.Web.CommonAPI.Utils do
data,
visibility
) do
no_attachment_links =
attachment_links =
data
|> Map.get("no_attachment_links", Config.get([:instance, :no_attachment_links]))
|> Map.get("attachment_links", Config.get([:instance, :attachment_links]))
|> truthy_param?()
content_type = get_content_type(data["content_type"])
@ -244,7 +244,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
status
|> format_input(content_type, options)
|> maybe_add_attachments(attachments, no_attachment_links)
|> maybe_add_attachments(attachments, attachment_links)
|> maybe_add_nsfw_tag(data)
end
@ -270,7 +270,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
def make_context(%Activity{data: %{"context" => context}}, _), do: context
def make_context(_, _), do: Utils.generate_context_id()
def maybe_add_attachments(parsed, _attachments, true = _no_links), do: parsed
def maybe_add_attachments(parsed, _attachments, false = _no_links), do: parsed
def maybe_add_attachments({text, mentions, tags}, attachments, _no_links) do
text = add_attachments(text, attachments)