Introduce get_by_id in Activity, replace newlines with spaces
This commit is contained in:
parent
850912b06b
commit
ff6c9a5c96
4 changed files with 7 additions and 4 deletions
|
@ -207,7 +207,7 @@
|
|||
ip: {0, 0, 0, 0},
|
||||
port: 9999
|
||||
|
||||
config :pleroma, :metadata, opengraph: true
|
||||
config :pleroma, :metadata, providers: []
|
||||
|
||||
config :pleroma, :suggestions,
|
||||
enabled: false,
|
||||
|
|
|
@ -35,7 +35,10 @@ def get_by_ap_id(ap_id) do
|
|||
)
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
def get_by_id(id) do
|
||||
Repo.get(Activity, id)
|
||||
end
|
||||
# TODO:
|
||||
# Go through these and fix them everywhere.
|
||||
# Wrong name, only returns create activities
|
||||
|
|
|
@ -47,6 +47,7 @@ defp scrub_html_and_truncate(content) do
|
|||
content
|
||||
# html content comes from DB already encoded, decode first and scrub after
|
||||
|> HtmlEntities.decode()
|
||||
|> String.replace(~r/<br\s?\/?>/, " ")
|
||||
|> HTML.strip_tags()
|
||||
|> Formatter.truncate()
|
||||
end
|
||||
|
|
|
@ -7,7 +7,6 @@ defmodule Pleroma.Web.OStatus.OStatusController do
|
|||
|
||||
alias Pleroma.{User, Activity, Object}
|
||||
alias Pleroma.Web.OStatus.{FeedRepresenter, ActivityRepresenter}
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.Web.{OStatus, Federator}
|
||||
alias Pleroma.Web.XML
|
||||
alias Pleroma.Web.ActivityPub.ObjectView
|
||||
|
@ -141,7 +140,7 @@ def activity(conn, %{"uuid" => uuid}) do
|
|||
end
|
||||
|
||||
def notice(conn, %{"id" => id}) do
|
||||
with {_, %Activity{} = activity} <- {:activity, Repo.get(Activity, id)},
|
||||
with {_, %Activity{} = activity} <- {:activity, Activity.get_by_id(id)},
|
||||
{_, true} <- {:public?, ActivityPub.is_public?(activity)},
|
||||
%User{} = user <- User.get_cached_by_ap_id(activity.data["actor"]) do
|
||||
case format = get_format(conn) do
|
||||
|
|
Loading…
Reference in a new issue