mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-24 10:07:24 +00:00
TwitterAPI: profile update with emoji_map
This commit is contained in:
parent
85434669bb
commit
46bbf9e1cf
|
@ -654,11 +654,17 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
||||||
|
|
||||||
defp parse_profile_bio(user, params) do
|
defp parse_profile_bio(user, params) do
|
||||||
if bio = params["description"] do
|
if bio = params["description"] do
|
||||||
|
emojis_text = (params["description"] || "") <> " " <> (params["name"] || "")
|
||||||
|
|
||||||
|
emojis =
|
||||||
|
((user.info.emoji || []) ++ Formatter.get_emoji_map(emojis_text))
|
||||||
|
|> Enum.dedup()
|
||||||
|
|
||||||
user_info =
|
user_info =
|
||||||
user.info
|
user.info
|
||||||
|> Map.put(
|
|> Map.put(
|
||||||
"emojis",
|
"emoji",
|
||||||
Formatter.get_emoji_map(params["description"])
|
emojis
|
||||||
)
|
)
|
||||||
|
|
||||||
params
|
params
|
||||||
|
|
|
@ -69,6 +69,11 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
|
||||||
|
|
||||||
emoji = Enum.dedup(emoji ++ user.info.emoji)
|
emoji = Enum.dedup(emoji ++ user.info.emoji)
|
||||||
|
|
||||||
|
description_html =
|
||||||
|
(user.bio || "")
|
||||||
|
|> HTML.filter_tags(User.html_filter_policy(for_user))
|
||||||
|
|> Formatter.emojify(emoji)
|
||||||
|
|
||||||
# ``fields`` is an array of mastodon profile field, containing ``{"name": "…", "value": "…"}``.
|
# ``fields`` is an array of mastodon profile field, containing ``{"name": "…", "value": "…"}``.
|
||||||
# For example: [{"name": "Pronoun", "value": "she/her"}, …]
|
# For example: [{"name": "Pronoun", "value": "she/her"}, …]
|
||||||
fields =
|
fields =
|
||||||
|
@ -80,7 +85,7 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
|
||||||
%{
|
%{
|
||||||
"created_at" => user.inserted_at |> Utils.format_naive_asctime(),
|
"created_at" => user.inserted_at |> Utils.format_naive_asctime(),
|
||||||
"description" => HTML.strip_tags((user.bio || "") |> String.replace("<br>", "\n")),
|
"description" => HTML.strip_tags((user.bio || "") |> String.replace("<br>", "\n")),
|
||||||
"description_html" => HTML.filter_tags(user.bio, User.html_filter_policy(for_user)),
|
"description_html" => description_html,
|
||||||
"favourites_count" => 0,
|
"favourites_count" => 0,
|
||||||
"followers_count" => user_info[:follower_count],
|
"followers_count" => user_info[:follower_count],
|
||||||
"following" => following,
|
"following" => following,
|
||||||
|
|
Loading…
Reference in a new issue