Browse Source

Introduce get_by_id in Activity, replace newlines with spaces

tags/v0.9.9
rinpatch 5 years ago
parent
commit
ff6c9a5c96
4 changed files with 7 additions and 4 deletions
  1. +1
    -1
      config/config.exs
  2. +4
    -1
      lib/pleroma/activity.ex
  3. +1
    -0
      lib/pleroma/web/metadata/opengraph.ex
  4. +1
    -2
      lib/pleroma/web/ostatus/ostatus_controller.ex

+ 1
- 1
config/config.exs View File

@@ -207,7 +207,7 @@ config :pleroma, :gopher,
ip: {0, 0, 0, 0},
port: 9999

config :pleroma, :metadata, opengraph: true
config :pleroma, :metadata, providers: []

config :pleroma, :suggestions,
enabled: false,


+ 4
- 1
lib/pleroma/activity.ex View File

@@ -35,7 +35,10 @@ defmodule Pleroma.Activity 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


+ 1
- 0
lib/pleroma/web/metadata/opengraph.ex View File

@@ -47,6 +47,7 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraph 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


+ 1
- 2
lib/pleroma/web/ostatus/ostatus_controller.ex View File

@@ -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 @@ defmodule Pleroma.Web.OStatus.OStatusController 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…
Cancel
Save