mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 18:17:55 +00:00
Use Pleroma.Formatter.linkify
instead of AutoLinker.link
This commit is contained in:
parent
dbf9d719f9
commit
7408f003a6
|
@ -16,6 +16,7 @@ defmodule Pleroma.User do
|
||||||
alias Pleroma.Conversation.Participation
|
alias Pleroma.Conversation.Participation
|
||||||
alias Pleroma.Delivery
|
alias Pleroma.Delivery
|
||||||
alias Pleroma.FollowingRelationship
|
alias Pleroma.FollowingRelationship
|
||||||
|
alias Pleroma.Formatter
|
||||||
alias Pleroma.HTML
|
alias Pleroma.HTML
|
||||||
alias Pleroma.Keys
|
alias Pleroma.Keys
|
||||||
alias Pleroma.Notification
|
alias Pleroma.Notification
|
||||||
|
@ -456,7 +457,7 @@ defmodule Pleroma.User do
|
||||||
|
|
||||||
fields =
|
fields =
|
||||||
raw_fields
|
raw_fields
|
||||||
|> Enum.map(fn f -> Map.update!(f, "value", &AutoLinker.link(&1)) end)
|
|> Enum.map(fn f -> Map.update!(f, "value", &parse_fields(&1)) end)
|
||||||
|
|
||||||
changeset
|
changeset
|
||||||
|> put_change(:raw_fields, raw_fields)
|
|> put_change(:raw_fields, raw_fields)
|
||||||
|
@ -466,6 +467,12 @@ defmodule Pleroma.User do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp parse_fields(value) do
|
||||||
|
value
|
||||||
|
|> Formatter.linkify(mentions_format: :full)
|
||||||
|
|> elem(0)
|
||||||
|
end
|
||||||
|
|
||||||
defp put_change_if_present(changeset, map_field, value_function) do
|
defp put_change_if_present(changeset, map_field, value_function) do
|
||||||
if value = get_change(changeset, map_field) do
|
if value = get_change(changeset, map_field) do
|
||||||
with {:ok, new_value} <- value_function.(value) do
|
with {:ok, new_value} <- value_function.(value) do
|
||||||
|
|
Loading…
Reference in a new issue