projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'length-limit-bio' into 'develop'
[akkoma]
/
lib
/
pleroma
/
web
/
twitter_api
/
views
/
user_view.ex
diff --git
a/lib/pleroma/web/twitter_api/views/user_view.ex
b/lib/pleroma/web/twitter_api/views/user_view.ex
index 39b3f21c0f6ad65ec2e466d863f3d8804666ba72..8d88920685f8cd03dfe37ba72ec10cab932c3a5c 100644
(file)
--- a/
lib/pleroma/web/twitter_api/views/user_view.ex
+++ b/
lib/pleroma/web/twitter_api/views/user_view.ex
@@
-67,6
+67,13
@@
defmodule Pleroma.Web.TwitterAPI.UserView do
{String.trim(name, ":"), url}
end)
{String.trim(name, ":"), url}
end)
+ 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": "…"}``.
# For example: [{"name": "Pronoun", "value": "she/her"}, …]
fields =
# ``fields`` is an array of mastodon profile field, containing ``{"name": "…", "value": "…"}``.
# For example: [{"name": "Pronoun", "value": "she/her"}, …]
fields =
@@
-78,7
+85,7
@@
defmodule Pleroma.Web.TwitterAPI.UserView do
%{
"created_at" => user.inserted_at |> Utils.format_naive_asctime(),
"description" => HTML.strip_tags((user.bio || "") |> String.replace("<br>", "\n")),
%{
"created_at" => user.inserted_at |> Utils.format_naive_asctime(),
"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,
"followers_count" => user_info[:follower_count],
"following" => following,
"favourites_count" => 0,
"followers_count" => user_info[:follower_count],
"following" => following,
@@
-111,17
+118,14
@@
defmodule Pleroma.Web.TwitterAPI.UserView do
"pleroma" =>
%{
"confirmation_pending" => user_info.confirmation_pending,
"pleroma" =>
%{
"confirmation_pending" => user_info.confirmation_pending,
- "tags" => user.tags
+ "tags" => user.tags,
+ "skip_thread_containment" => user.info.skip_thread_containment
}
|> maybe_with_activation_status(user, for_user)
}
|> maybe_with_activation_status(user, for_user)
+ |> with_notification_settings(user, for_user)
}
|> maybe_with_user_settings(user, for_user)
}
|> maybe_with_user_settings(user, for_user)
-
- data =
- if(user.info.is_admin || user.info.is_moderator,
- do: maybe_with_role(data, user, for_user),
- else: data
- )
+ |> maybe_with_role(user, for_user)
if assigns[:token] do
Map.put(data, "token", token_string(assigns[:token]))
if assigns[:token] do
Map.put(data, "token", token_string(assigns[:token]))
@@
-130,6
+134,12
@@
defmodule Pleroma.Web.TwitterAPI.UserView do
end
end
end
end
+ defp with_notification_settings(data, %User{id: user_id} = user, %User{id: user_id}) do
+ Map.put(data, "notification_settings", user.info.notification_settings)
+ end
+
+ defp with_notification_settings(data, _, _), do: data
+
defp maybe_with_activation_status(data, user, %User{info: %{is_admin: true}}) do
Map.put(data, "deactivated", user.info.deactivated)
end
defp maybe_with_activation_status(data, user, %User{info: %{is_admin: true}}) do
Map.put(data, "deactivated", user.info.deactivated)
end