field(:hub, :string, default: nil)
field(:salmon, :string, default: nil)
field(:hide_followers, :boolean, default: false)
- field(:hide_followings, :boolean, default: false)
+ field(:hide_follows, :boolean, default: false)
field(:pinned_activities, {:array, :string}, default: [])
# Found in the wild
:no_rich_text,
:default_scope,
:banner,
- :hide_followings,
+ :hide_follows,
:hide_followers,
:background,
:show_role
query = from(user in query, select: [:ap_id])
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())
end
"id" => "#{user.ap_id}/following",
"type" => "OrderedCollection",
"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())
end
followers =
cond do
for_user && user.id == for_user.id -> followers
- user.info.hide_followings -> []
+ user.info.hide_follows -> []
true -> followers
end
friends =
cond do
for_user && user.id == for_user.id -> friends
- user.info.hide_followings -> []
+ user.info.hide_follows -> []
true -> friends
end
defp build_info_cng(user, params) do
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 ->
if value = params[key] do
Map.put(res, key, value == "true")
"default_scope" => user.info.default_scope,
"no_rich_text" => user.info.no_rich_text,
"hide_followers" => user.info.hide_followers,
- "hide_followings" => user.info.hide_followings,
+ "hide_follows" => user.info.hide_follows,
"fields" => fields,
# Pleroma extension
assert result["first"]["orderedItems"] == [user_two.ap_id]
end
- test "it returns returns empty if the user has 'hide_followings' set", %{conn: conn} do
- user = insert(:user, %{info: %{hide_followings: true}})
+ test "it returns returns empty if the user has 'hide_follows' set", %{conn: conn} do
+ user = insert(:user, %{info: %{hide_follows: true}})
user_two = insert(:user)
User.follow(user, user_two)
assert id == to_string(other_user.id)
end
- test "getting following, hide_followings", %{conn: conn} do
- user = insert(:user, %{info: %{hide_followings: true}})
+ test "getting following, hide_follows", %{conn: conn} do
+ user = insert(:user, %{info: %{hide_follows: true}})
other_user = insert(:user)
{:ok, user} = User.follow(user, other_user)
assert [] == json_response(conn, 200)
end
- test "getting following, hide_followings, same user requesting", %{conn: conn} do
- user = insert(:user, %{info: %{hide_followings: true}})
+ test "getting following, hide_follows, same user requesting", %{conn: conn} do
+ user = insert(:user, %{info: %{hide_follows: true}})
other_user = insert(:user)
{:ok, user} = User.follow(user, other_user)
)
end
- test "it returns empty when hide_followings is set to true", %{conn: conn} do
- user = insert(:user, %{info: %{hide_followings: true}})
+ test "it returns empty when hide_follows is set to true", %{conn: conn} do
+ user = insert(:user, %{info: %{hide_follows: true}})
followed_one = insert(:user)
followed_two = insert(:user)
not_followed = insert(:user)
assert [] == json_response(conn, 200)
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
} do
- user = insert(:user, %{info: %{hide_followings: true}})
+ user = insert(:user, %{info: %{hide_follows: true}})
followed_one = insert(:user)
followed_two = insert(:user)
_not_followed = insert(:user)
assert json_response(conn, 200) == UserView.render("user.json", %{user: user, for: user})
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)
conn
|> assign(:user, user)
|> post("/api/account/update_profile.json", %{
- "hide_followings" => "true"
+ "hide_follows" => "true"
})
user = Repo.get!(User, user.id)
- assert user.info.hide_followings == true
+ assert user.info.hide_follows == true
conn =
conn
|> assign(:user, user)
|> post("/api/account/update_profile.json", %{
- "hide_followings" => "false"
+ "hide_follows" => "false"
})
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})
end
"locked" => false,
"default_scope" => "public",
"no_rich_text" => false,
- "hide_followings" => false,
+ "hide_follows" => false,
"hide_followers" => false,
"fields" => [],
"pleroma" => %{
"locked" => false,
"default_scope" => "public",
"no_rich_text" => false,
- "hide_followings" => false,
+ "hide_follows" => false,
"hide_followers" => false,
"fields" => [],
"pleroma" => %{
"locked" => false,
"default_scope" => "public",
"no_rich_text" => false,
- "hide_followings" => false,
+ "hide_follows" => false,
"hide_followers" => false,
"fields" => [],
"pleroma" => %{
"locked" => false,
"default_scope" => "public",
"no_rich_text" => false,
- "hide_followings" => false,
+ "hide_follows" => false,
"hide_followers" => false,
"fields" => [],
"pleroma" => %{