X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Ftwitter_api%2Ftwitter_api_controller.ex;h=c6637e38db9f37d8b3773db077612214dcc1789b;hb=9fe9c098831fa2071bbe68024d135736208addb5;hp=dfa6d2464102f1bfeeeba0f8c791310192f83318;hpb=5debd7b5cc31a6dedd8d0c8bc177be2cd1b995aa;p=akkoma diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex index dfa6d2464..c6637e38d 100644 --- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex +++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex @@ -415,15 +415,16 @@ defmodule Pleroma.Web.TwitterAPI.Controller do if bio = params["description"] do mentions = Formatter.parse_mentions(bio) tags = Formatter.parse_tags(bio) + emoji = (user.info["source_data"]["tag"] || []) |> Enum.filter(fn %{"type" => t} -> t == "Emoji" end) |> Enum.map(fn %{"icon" => %{"url" => url}, "name" => name} -> {String.trim(name, ":"), url} end) - bio_html = CommonUtils.format_input(bio, mentions, tags) - |> Formatter.emojify(emoji) - Map.put(params, "bio", bio_html) + + bio_html = CommonUtils.format_input(bio, mentions, tags, "text/plain") + Map.put(params, "bio", bio_html |> Formatter.emojify(emoji)) else params end @@ -442,6 +443,20 @@ defmodule Pleroma.Web.TwitterAPI.Controller do user end + user = + if no_rich_text = params["no_rich_text"] do + with no_rich_text <- no_rich_text == "true", + new_info <- Map.put(user.info, "no_rich_text", no_rich_text), + change <- User.info_changeset(user, %{info: new_info}), + {:ok, user} <- User.update_and_set_cache(change) do + user + else + _e -> user + end + else + user + end + user = if default_scope = params["default_scope"] do with new_info <- Map.put(user.info, "default_scope", default_scope),