projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Web.TwitterAPI.UserView: Add rights.admin
[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 b3459af9af7768cc2316b1f122f75fecfeee193f..c04d143c83da5c5acbefb7a573761300bf58f2de 100644
(file)
--- a/
lib/pleroma/web/twitter_api/views/user_view.ex
+++ b/
lib/pleroma/web/twitter_api/views/user_view.ex
@@
-1,3
+1,7
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.TwitterAPI.UserView do
use Pleroma.Web, :view
alias Pleroma.User
defmodule Pleroma.Web.TwitterAPI.UserView do
use Pleroma.Web, :view
alias Pleroma.User
@@
-66,7
+70,8
@@
defmodule Pleroma.Web.TwitterAPI.UserView do
"profile_image_url_profile_size" => image,
"profile_image_url_original" => image,
"rights" => %{
"profile_image_url_profile_size" => image,
"profile_image_url_original" => image,
"rights" => %{
- "delete_others_notice" => !!user.info.is_moderator
+ "delete_others_notice" => !!user.info.is_moderator,
+ "admin" => !!user.info.is_admin
},
"screen_name" => user.nickname,
"statuses_count" => user_info[:note_count],
},
"screen_name" => user.nickname,
"statuses_count" => user_info[:note_count],
@@
-81,12
+86,13
@@
defmodule Pleroma.Web.TwitterAPI.UserView do
# Pleroma extension
"pleroma" => %{
# Pleroma extension
"pleroma" => %{
+ "confirmation_pending" => user_info.confirmation_pending,
"tags" => user.tags
}
}
if assigns[:token] do
"tags" => user.tags
}
}
if assigns[:token] do
- Map.put(data, "token",
assigns[:token]
)
+ Map.put(data, "token",
token_string(assigns[:token])
)
else
data
end
else
data
end
@@
-111,4
+117,7
@@
defmodule Pleroma.Web.TwitterAPI.UserView do
defp image_url(%{"url" => [%{"href" => href} | _]}), do: href
defp image_url(_), do: nil
defp image_url(%{"url" => [%{"href" => href} | _]}), do: href
defp image_url(_), do: nil
+
+ defp token_string(%Pleroma.Web.OAuth.Token{token: token_str}), do: token_str
+ defp token_string(token), do: token
end
end