Merge branch 'regression/rights-only-for-admin' into 'develop'
Fix `rights` in TwitterAPI's user entity being present only for Admins/Moderators See merge request pleroma/pleroma!1102
This commit is contained in:
commit
292c69481b
@ -116,12 +116,7 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
|
|||||||
|> maybe_with_activation_status(user, for_user)
|
|> maybe_with_activation_status(user, for_user)
|
||||||
}
|
}
|
||||||
|> maybe_with_user_settings(user, for_user)
|
|> maybe_with_user_settings(user, for_user)
|
||||||
|
|> maybe_with_role(user, for_user)
|
||||||
data =
|
|
||||||
if(user.info.is_admin || user.info.is_moderator,
|
|
||||||
do: maybe_with_role(data, user, for_user),
|
|
||||||
else: data
|
|
||||||
)
|
|
||||||
|
|
||||||
if assigns[:token] do
|
if assigns[:token] do
|
||||||
Map.put(data, "token", token_string(assigns[:token]))
|
Map.put(data, "token", token_string(assigns[:token]))
|
||||||
|
@ -100,7 +100,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||||||
"pleroma" => %{
|
"pleroma" => %{
|
||||||
"confirmation_pending" => false,
|
"confirmation_pending" => false,
|
||||||
"tags" => []
|
"tags" => []
|
||||||
}
|
},
|
||||||
|
"rights" => %{"admin" => false, "delete_others_notice" => false},
|
||||||
|
"role" => "member"
|
||||||
}
|
}
|
||||||
|
|
||||||
assert represented == UserView.render("show.json", %{user: user})
|
assert represented == UserView.render("show.json", %{user: user})
|
||||||
@ -151,7 +153,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||||||
"pleroma" => %{
|
"pleroma" => %{
|
||||||
"confirmation_pending" => false,
|
"confirmation_pending" => false,
|
||||||
"tags" => []
|
"tags" => []
|
||||||
}
|
},
|
||||||
|
"rights" => %{"admin" => false, "delete_others_notice" => false},
|
||||||
|
"role" => "member"
|
||||||
}
|
}
|
||||||
|
|
||||||
assert represented == UserView.render("show.json", %{user: user, for: follower})
|
assert represented == UserView.render("show.json", %{user: user, for: follower})
|
||||||
@ -194,7 +198,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||||||
"pleroma" => %{
|
"pleroma" => %{
|
||||||
"confirmation_pending" => false,
|
"confirmation_pending" => false,
|
||||||
"tags" => []
|
"tags" => []
|
||||||
}
|
},
|
||||||
|
"rights" => %{"admin" => false, "delete_others_notice" => false},
|
||||||
|
"role" => "member"
|
||||||
}
|
}
|
||||||
|
|
||||||
assert represented == UserView.render("show.json", %{user: follower, for: user})
|
assert represented == UserView.render("show.json", %{user: follower, for: user})
|
||||||
@ -274,7 +280,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||||||
"pleroma" => %{
|
"pleroma" => %{
|
||||||
"confirmation_pending" => false,
|
"confirmation_pending" => false,
|
||||||
"tags" => []
|
"tags" => []
|
||||||
}
|
},
|
||||||
|
"rights" => %{"admin" => false, "delete_others_notice" => false},
|
||||||
|
"role" => "member"
|
||||||
}
|
}
|
||||||
|
|
||||||
blocker = User.get_cached_by_id(blocker.id)
|
blocker = User.get_cached_by_id(blocker.id)
|
||||||
|
Loading…
Reference in New Issue
Block a user