mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 06:58:58 +00:00
Web.TwitterAPI.UserView: Add rights.admin
This commit is contained in:
parent
e1de866f95
commit
b43d630f30
|
@ -966,7 +966,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
max_toot_chars: limit
|
||||
},
|
||||
rights: %{
|
||||
delete_others_notice: !!user.info.is_moderator
|
||||
delete_others_notice: !!user.info.is_moderator,
|
||||
admin: !!user.info.is_admin
|
||||
},
|
||||
compose: %{
|
||||
me: "#{user.id}",
|
||||
|
|
|
@ -70,7 +70,8 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
|
|||
"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],
|
||||
|
|
|
@ -90,7 +90,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"follows_you" => false,
|
||||
"statusnet_blocking" => false,
|
||||
"rights" => %{
|
||||
"delete_others_notice" => false
|
||||
"delete_others_notice" => false,
|
||||
"admin" => false
|
||||
},
|
||||
"statusnet_profile_url" => user.ap_id,
|
||||
"cover_photo" => banner,
|
||||
|
@ -135,7 +136,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"follows_you" => false,
|
||||
"statusnet_blocking" => false,
|
||||
"rights" => %{
|
||||
"delete_others_notice" => false
|
||||
"delete_others_notice" => false,
|
||||
"admin" => false
|
||||
},
|
||||
"statusnet_profile_url" => user.ap_id,
|
||||
"cover_photo" => banner,
|
||||
|
@ -181,7 +183,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"follows_you" => true,
|
||||
"statusnet_blocking" => false,
|
||||
"rights" => %{
|
||||
"delete_others_notice" => false
|
||||
"delete_others_notice" => false,
|
||||
"admin" => false
|
||||
},
|
||||
"statusnet_profile_url" => follower.ap_id,
|
||||
"cover_photo" => banner,
|
||||
|
@ -207,6 +210,13 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
assert represented["rights"]["delete_others_notice"]
|
||||
end
|
||||
|
||||
test "a user that is a admin" do
|
||||
user = insert(:user, %{info: %{is_admin: true}})
|
||||
represented = UserView.render("show.json", %{user: user, for: user})
|
||||
|
||||
assert represented["rights"]["admin"]
|
||||
end
|
||||
|
||||
test "A blocked user for the blocker" do
|
||||
user = insert(:user)
|
||||
blocker = insert(:user)
|
||||
|
@ -234,7 +244,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"follows_you" => false,
|
||||
"statusnet_blocking" => true,
|
||||
"rights" => %{
|
||||
"delete_others_notice" => false
|
||||
"delete_others_notice" => false,
|
||||
"admin" => false
|
||||
},
|
||||
"statusnet_profile_url" => user.ap_id,
|
||||
"cover_photo" => banner,
|
||||
|
|
Loading…
Reference in a new issue