hide_followings was renamed to hide_followers in the FE, but never synced up in the BE
This was a dirty regex replace which worked on my server
This commit is contained in:
parent
1220a17146
commit
74518d0b60
9 changed files with 27 additions and 27 deletions
|
@ -32,7 +32,7 @@ defmodule Pleroma.User.Info do
|
||||||
field(:hub, :string, default: nil)
|
field(:hub, :string, default: nil)
|
||||||
field(:salmon, :string, default: nil)
|
field(:salmon, :string, default: nil)
|
||||||
field(:hide_followers, :boolean, default: false)
|
field(:hide_followers, :boolean, default: false)
|
||||||
field(:hide_followings, :boolean, default: false)
|
field(:hide_follows, :boolean, default: false)
|
||||||
field(:pinned_activities, {:array, :string}, default: [])
|
field(:pinned_activities, {:array, :string}, default: [])
|
||||||
|
|
||||||
# Found in the wild
|
# Found in the wild
|
||||||
|
@ -145,7 +145,7 @@ defmodule Pleroma.User.Info do
|
||||||
:no_rich_text,
|
:no_rich_text,
|
||||||
:default_scope,
|
:default_scope,
|
||||||
:banner,
|
:banner,
|
||||||
:hide_followings,
|
:hide_follows,
|
||||||
:hide_followers,
|
:hide_followers,
|
||||||
:background,
|
:background,
|
||||||
:show_role
|
:show_role
|
||||||
|
|
|
@ -86,7 +86,7 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
||||||
query = from(user in query, select: [:ap_id])
|
query = from(user in query, select: [:ap_id])
|
||||||
following = Repo.all(query)
|
following = Repo.all(query)
|
||||||
|
|
||||||
collection(following, "#{user.ap_id}/following", page, !user.info.hide_followings)
|
collection(following, "#{user.ap_id}/following", page, !user.info.hide_follows)
|
||||||
|> Map.merge(Utils.make_json_ld_header())
|
|> Map.merge(Utils.make_json_ld_header())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
||||||
"id" => "#{user.ap_id}/following",
|
"id" => "#{user.ap_id}/following",
|
||||||
"type" => "OrderedCollection",
|
"type" => "OrderedCollection",
|
||||||
"totalItems" => length(following),
|
"totalItems" => length(following),
|
||||||
"first" => collection(following, "#{user.ap_id}/following", 1, !user.info.hide_followings)
|
"first" => collection(following, "#{user.ap_id}/following", 1, !user.info.hide_follows)
|
||||||
}
|
}
|
||||||
|> Map.merge(Utils.make_json_ld_header())
|
|> Map.merge(Utils.make_json_ld_header())
|
||||||
end
|
end
|
||||||
|
|
|
@ -621,7 +621,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
||||||
followers =
|
followers =
|
||||||
cond do
|
cond do
|
||||||
for_user && user.id == for_user.id -> followers
|
for_user && user.id == for_user.id -> followers
|
||||||
user.info.hide_followings -> []
|
user.info.hide_follows -> []
|
||||||
true -> followers
|
true -> followers
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -523,7 +523,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
||||||
friends =
|
friends =
|
||||||
cond do
|
cond do
|
||||||
for_user && user.id == for_user.id -> friends
|
for_user && user.id == for_user.id -> friends
|
||||||
user.info.hide_followings -> []
|
user.info.hide_follows -> []
|
||||||
true -> friends
|
true -> friends
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -618,7 +618,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
||||||
|
|
||||||
defp build_info_cng(user, params) do
|
defp build_info_cng(user, params) do
|
||||||
info_params =
|
info_params =
|
||||||
["no_rich_text", "locked", "hide_followers", "hide_followings", "show_role"]
|
["no_rich_text", "locked", "hide_followers", "hide_follows", "show_role"]
|
||||||
|> Enum.reduce(%{}, fn key, res ->
|
|> Enum.reduce(%{}, fn key, res ->
|
||||||
if value = params[key] do
|
if value = params[key] do
|
||||||
Map.put(res, key, value == "true")
|
Map.put(res, key, value == "true")
|
||||||
|
|
|
@ -109,7 +109,7 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
|
||||||
"default_scope" => user.info.default_scope,
|
"default_scope" => user.info.default_scope,
|
||||||
"no_rich_text" => user.info.no_rich_text,
|
"no_rich_text" => user.info.no_rich_text,
|
||||||
"hide_followers" => user.info.hide_followers,
|
"hide_followers" => user.info.hide_followers,
|
||||||
"hide_followings" => user.info.hide_followings,
|
"hide_follows" => user.info.hide_follows,
|
||||||
"fields" => fields,
|
"fields" => fields,
|
||||||
|
|
||||||
# Pleroma extension
|
# Pleroma extension
|
||||||
|
|
|
@ -441,8 +441,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|
||||||
assert result["first"]["orderedItems"] == [user_two.ap_id]
|
assert result["first"]["orderedItems"] == [user_two.ap_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it returns returns empty if the user has 'hide_followings' set", %{conn: conn} do
|
test "it returns returns empty if the user has 'hide_follows' set", %{conn: conn} do
|
||||||
user = insert(:user, %{info: %{hide_followings: true}})
|
user = insert(:user, %{info: %{hide_follows: true}})
|
||||||
user_two = insert(:user)
|
user_two = insert(:user)
|
||||||
User.follow(user, user_two)
|
User.follow(user, user_two)
|
||||||
|
|
||||||
|
|
|
@ -1139,8 +1139,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
||||||
assert id == to_string(other_user.id)
|
assert id == to_string(other_user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "getting following, hide_followings", %{conn: conn} do
|
test "getting following, hide_follows", %{conn: conn} do
|
||||||
user = insert(:user, %{info: %{hide_followings: true}})
|
user = insert(:user, %{info: %{hide_follows: true}})
|
||||||
other_user = insert(:user)
|
other_user = insert(:user)
|
||||||
{:ok, user} = User.follow(user, other_user)
|
{:ok, user} = User.follow(user, other_user)
|
||||||
|
|
||||||
|
@ -1151,8 +1151,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
||||||
assert [] == json_response(conn, 200)
|
assert [] == json_response(conn, 200)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "getting following, hide_followings, same user requesting", %{conn: conn} do
|
test "getting following, hide_follows, same user requesting", %{conn: conn} do
|
||||||
user = insert(:user, %{info: %{hide_followings: true}})
|
user = insert(:user, %{info: %{hide_follows: true}})
|
||||||
other_user = insert(:user)
|
other_user = insert(:user)
|
||||||
{:ok, user} = User.follow(user, other_user)
|
{:ok, user} = User.follow(user, other_user)
|
||||||
|
|
||||||
|
|
|
@ -1261,8 +1261,8 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it returns empty when hide_followings is set to true", %{conn: conn} do
|
test "it returns empty when hide_follows is set to true", %{conn: conn} do
|
||||||
user = insert(:user, %{info: %{hide_followings: true}})
|
user = insert(:user, %{info: %{hide_follows: true}})
|
||||||
followed_one = insert(:user)
|
followed_one = insert(:user)
|
||||||
followed_two = insert(:user)
|
followed_two = insert(:user)
|
||||||
not_followed = insert(:user)
|
not_followed = insert(:user)
|
||||||
|
@ -1278,11 +1278,11 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
|
||||||
assert [] == json_response(conn, 200)
|
assert [] == json_response(conn, 200)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it returns friends when hide_followings is set to true if the user themselves request it",
|
test "it returns friends when hide_follows is set to true if the user themselves request it",
|
||||||
%{
|
%{
|
||||||
conn: conn
|
conn: conn
|
||||||
} do
|
} do
|
||||||
user = insert(:user, %{info: %{hide_followings: true}})
|
user = insert(:user, %{info: %{hide_follows: true}})
|
||||||
followed_one = insert(:user)
|
followed_one = insert(:user)
|
||||||
followed_two = insert(:user)
|
followed_two = insert(:user)
|
||||||
_not_followed = insert(:user)
|
_not_followed = insert(:user)
|
||||||
|
@ -1370,27 +1370,27 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
|
||||||
assert json_response(conn, 200) == UserView.render("user.json", %{user: user, for: user})
|
assert json_response(conn, 200) == UserView.render("user.json", %{user: user, for: user})
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it sets and un-sets hide_followings", %{conn: conn} do
|
test "it sets and un-sets hide_follows", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/account/update_profile.json", %{
|
|> post("/api/account/update_profile.json", %{
|
||||||
"hide_followings" => "true"
|
"hide_follows" => "true"
|
||||||
})
|
})
|
||||||
|
|
||||||
user = Repo.get!(User, user.id)
|
user = Repo.get!(User, user.id)
|
||||||
assert user.info.hide_followings == true
|
assert user.info.hide_follows == true
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/account/update_profile.json", %{
|
|> post("/api/account/update_profile.json", %{
|
||||||
"hide_followings" => "false"
|
"hide_follows" => "false"
|
||||||
})
|
})
|
||||||
|
|
||||||
user = Repo.get!(User, user.id)
|
user = Repo.get!(User, user.id)
|
||||||
assert user.info.hide_followings == false
|
assert user.info.hide_follows == false
|
||||||
assert json_response(conn, 200) == UserView.render("user.json", %{user: user, for: user})
|
assert json_response(conn, 200) == UserView.render("user.json", %{user: user, for: user})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
||||||
"locked" => false,
|
"locked" => false,
|
||||||
"default_scope" => "public",
|
"default_scope" => "public",
|
||||||
"no_rich_text" => false,
|
"no_rich_text" => false,
|
||||||
"hide_followings" => false,
|
"hide_follows" => false,
|
||||||
"hide_followers" => false,
|
"hide_followers" => false,
|
||||||
"fields" => [],
|
"fields" => [],
|
||||||
"pleroma" => %{
|
"pleroma" => %{
|
||||||
|
@ -148,7 +148,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
||||||
"locked" => false,
|
"locked" => false,
|
||||||
"default_scope" => "public",
|
"default_scope" => "public",
|
||||||
"no_rich_text" => false,
|
"no_rich_text" => false,
|
||||||
"hide_followings" => false,
|
"hide_follows" => false,
|
||||||
"hide_followers" => false,
|
"hide_followers" => false,
|
||||||
"fields" => [],
|
"fields" => [],
|
||||||
"pleroma" => %{
|
"pleroma" => %{
|
||||||
|
@ -197,7 +197,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
||||||
"locked" => false,
|
"locked" => false,
|
||||||
"default_scope" => "public",
|
"default_scope" => "public",
|
||||||
"no_rich_text" => false,
|
"no_rich_text" => false,
|
||||||
"hide_followings" => false,
|
"hide_follows" => false,
|
||||||
"hide_followers" => false,
|
"hide_followers" => false,
|
||||||
"fields" => [],
|
"fields" => [],
|
||||||
"pleroma" => %{
|
"pleroma" => %{
|
||||||
|
@ -276,7 +276,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
||||||
"locked" => false,
|
"locked" => false,
|
||||||
"default_scope" => "public",
|
"default_scope" => "public",
|
||||||
"no_rich_text" => false,
|
"no_rich_text" => false,
|
||||||
"hide_followings" => false,
|
"hide_follows" => false,
|
||||||
"hide_followers" => false,
|
"hide_followers" => false,
|
||||||
"fields" => [],
|
"fields" => [],
|
||||||
"pleroma" => %{
|
"pleroma" => %{
|
||||||
|
|
Loading…
Reference in a new issue