aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-07-23 15:08:30 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-07-23 15:08:30 +0300
commit9ea51a6de516b37341a9566d11d0110c2d87c1b6 (patch)
tree8d06667accd928ff0dc0fb1d85be3d6b2e99ccd7 /lib/pleroma/web
parent6f5f7af607518b6f67df68bab9bf76142e9a622c (diff)
downloadpleroma-9ea51a6de516b37341a9566d11d0110c2d87c1b6.tar.gz
[#2791] AccountView: renamed `:force` option to `:skip_visibility_check`.
Diffstat (limited to 'lib/pleroma/web')
-rw-r--r--lib/pleroma/web/activity_pub/utils.ex2
-rw-r--r--lib/pleroma/web/admin_api/views/account_view.ex2
-rw-r--r--lib/pleroma/web/chat_channel.ex2
-rw-r--r--lib/pleroma/web/mastodon_api/views/account_view.ex8
-rw-r--r--lib/pleroma/web/pleroma_api/views/chat_view.ex2
5 files changed, 9 insertions, 7 deletions
diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex
index 11c64cffd..713b0ca1f 100644
--- a/lib/pleroma/web/activity_pub/utils.ex
+++ b/lib/pleroma/web/activity_pub/utils.ex
@@ -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}
)
}
diff --git a/lib/pleroma/web/admin_api/views/account_view.ex b/lib/pleroma/web/admin_api/views/account_view.ex
index 4ae030b84..88fbb5315 100644
--- a/lib/pleroma/web/admin_api/views/account_view.ex
+++ b/lib/pleroma/web/admin_api/views/account_view.ex
@@ -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
diff --git a/lib/pleroma/web/chat_channel.ex b/lib/pleroma/web/chat_channel.ex
index 08d0e80f9..3b1469c19 100644
--- a/lib/pleroma/web/chat_channel.ex
+++ b/lib/pleroma/web/chat_channel.ex
@@ -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})
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex
index b929d5a03..864c0417f 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -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
diff --git a/lib/pleroma/web/pleroma_api/views/chat_view.ex b/lib/pleroma/web/pleroma_api/views/chat_view.ex
index 2ae7c8122..04dc20d51 100644
--- a/lib/pleroma/web/pleroma_api/views/chat_view.ex
+++ b/lib/pleroma/web/pleroma_api/views/chat_view.ex
@@ -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