[#2791] AccountView: renamed :force option to :skip_visibility_check.
This commit is contained in:
parent
6f5f7af607
commit
9ea51a6de5
12 changed files with 44 additions and 29 deletions
|
|
@ -729,7 +729,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|||
"actor" =>
|
||||
AccountView.render(
|
||||
"show.json",
|
||||
%{user: activity_actor, force: true}
|
||||
%{user: activity_actor, skip_visibility_check: true}
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ defmodule Pleroma.Web.AdminAPI.AccountView do
|
|||
end
|
||||
|
||||
def merge_account_views(%User{} = user) do
|
||||
MastodonAPI.AccountView.render("show.json", %{user: user, force: true})
|
||||
MastodonAPI.AccountView.render("show.json", %{user: user, skip_visibility_check: true})
|
||||
|> Map.merge(AdminAPI.AccountView.render("show.json", %{user: user}))
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ defmodule Pleroma.Web.ChatChannel do
|
|||
|
||||
if String.length(text) in 1..Pleroma.Config.get([:instance, :chat_limit]) do
|
||||
author = User.get_cached_by_nickname(user_name)
|
||||
author_json = AccountView.render("show.json", user: author, force: true)
|
||||
author_json = AccountView.render("show.json", user: author, skip_visibility_check: true)
|
||||
|
||||
message = ChatChannelState.add_message(%{text: text, author: author_json})
|
||||
|
||||
|
|
|
|||
|
|
@ -39,11 +39,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
|
||||
@doc """
|
||||
Renders specified user account.
|
||||
:force option skips visibility check and renders any user (local or remote)
|
||||
:skip_visibility_check option skips visibility check and renders any user (local or remote)
|
||||
regardless of [:pleroma, :restrict_unauthenticated] setting.
|
||||
:for option specifies the requester and can be a User record or nil.
|
||||
Only use `user: user, for: user` when `user` is the actual requester of own profile.
|
||||
"""
|
||||
def render("show.json", %{user: _user, force: true} = opts) do
|
||||
def render("show.json", %{user: _user, skip_visibility_check: true} = opts) do
|
||||
do_render("show.json", opts)
|
||||
end
|
||||
|
||||
|
|
@ -56,7 +57,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
end
|
||||
|
||||
def render("show.json", _) do
|
||||
raise "In order to prevent account accessibility issues, :force or :for option is required."
|
||||
raise "In order to prevent account accessibility issues, " <>
|
||||
":skip_visibility_check or :for option is required."
|
||||
end
|
||||
|
||||
def render("mention.json", %{user: user}) do
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatView do
|
|||
if Map.has_key?(account_view_opts, :for) do
|
||||
account_view_opts
|
||||
else
|
||||
Map.put(account_view_opts, :force, true)
|
||||
Map.put(account_view_opts, :skip_visibility_check, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue