diff options
author | kaniini <nenolod@gmail.com> | 2019-01-19 07:36:58 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-01-19 07:36:58 +0000 |
commit | 651ce1c97bf0754f170032b47abcb19ac0794e74 (patch) | |
tree | b62cb31ac6f8c42230c99e522c0f7d2f042f26d6 /lib/pleroma/web | |
parent | 98d9dcd509ab6823e38b3ddbce1f5fc4f3d5a82c (diff) | |
parent | 65bb9b2fba7560df7331645db9839305c47dad11 (diff) | |
download | pleroma-651ce1c97bf0754f170032b47abcb19ac0794e74.tar.gz |
Merge branch '491_full_mentions_in_user_bio' into 'develop'
[#491] Made user bio preserve full nicknames (nick@host)
Closes #491
See merge request pleroma/pleroma!676
Diffstat (limited to 'lib/pleroma/web')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 7e30d224c..a36ab5c15 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -116,16 +116,18 @@ defmodule Pleroma.Web.CommonAPI.Utils do Enum.join([text | attachment_text], "<br>") end + def format_input(text, mentions, tags, format, options \\ []) + @doc """ Formatting text to plain text. """ - def format_input(text, mentions, tags, "text/plain") do + def format_input(text, mentions, tags, "text/plain", options) do text |> Formatter.html_escape("text/plain") |> String.replace(~r/\r?\n/, "<br>") |> (&{[], &1}).() |> Formatter.add_links() - |> Formatter.add_user_links(mentions) + |> Formatter.add_user_links(mentions, options[:user_links] || []) |> Formatter.add_hashtag_links(tags) |> Formatter.finalize() end @@ -133,24 +135,24 @@ defmodule Pleroma.Web.CommonAPI.Utils do @doc """ Formatting text to html. """ - def format_input(text, mentions, _tags, "text/html") do + def format_input(text, mentions, _tags, "text/html", options) do text |> Formatter.html_escape("text/html") |> (&{[], &1}).() - |> Formatter.add_user_links(mentions) + |> Formatter.add_user_links(mentions, options[:user_links] || []) |> Formatter.finalize() end @doc """ Formatting text to markdown. """ - def format_input(text, mentions, tags, "text/markdown") do + def format_input(text, mentions, tags, "text/markdown", options) do text |> Formatter.mentions_escape(mentions) |> Earmark.as_html!() |> Formatter.html_escape("text/html") |> (&{[], &1}).() - |> Formatter.add_user_links(mentions) + |> Formatter.add_user_links(mentions, options[:user_links] || []) |> Formatter.add_hashtag_links(tags) |> Formatter.finalize() end |