projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'feature/add-roles-to-users-admin-api' 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 a09450df74629f63d92746aee30309cd1286712f..0791ed7608e1be3b3318d63a456f067d4d41ea02 100644
(file)
--- a/
lib/pleroma/web/twitter_api/views/user_view.ex
+++ b/
lib/pleroma/web/twitter_api/views/user_view.ex
@@
-113,10
+113,12
@@
defmodule Pleroma.Web.TwitterAPI.UserView do
"fields" => fields,
# Pleroma extension
"fields" => fields,
# Pleroma extension
- "pleroma" => %{
- "confirmation_pending" => user_info.confirmation_pending,
- "tags" => user.tags
- }
+ "pleroma" =>
+ %{
+ "confirmation_pending" => user_info.confirmation_pending,
+ "tags" => user.tags
+ }
+ |> maybe_with_activation_status(user, for_user)
}
data =
}
data =
@@
-132,6
+134,12
@@
defmodule Pleroma.Web.TwitterAPI.UserView do
end
end
end
end
+ 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, _, _), do: data
+
defp maybe_with_role(data, %User{id: id} = user, %User{id: id}) do
Map.merge(data, %{"role" => role(user), "show_role" => user.info.show_role})
end
defp maybe_with_role(data, %User{id: id} = user, %User{id: id}) do
Map.merge(data, %{"role" => role(user), "show_role" => user.info.show_role})
end