Merge branch 'develop' into 'remove-avatar-header'
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
a0c65bbd6c
237 changed files with 8534 additions and 2226 deletions
|
|
@ -168,41 +168,25 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
|
|||
end
|
||||
|
||||
test "returns 403 to unauthenticated request when the instance is not public", %{conn: conn} do
|
||||
instance =
|
||||
Application.get_env(:pleroma, :instance)
|
||||
|> Keyword.put(:public, false)
|
||||
|
||||
Application.put_env(:pleroma, :instance, instance)
|
||||
Pleroma.Config.put([:instance, :public], false)
|
||||
|
||||
conn
|
||||
|> get("/api/statuses/public_timeline.json")
|
||||
|> json_response(403)
|
||||
|
||||
instance =
|
||||
Application.get_env(:pleroma, :instance)
|
||||
|> Keyword.put(:public, true)
|
||||
|
||||
Application.put_env(:pleroma, :instance, instance)
|
||||
Pleroma.Config.put([:instance, :public], true)
|
||||
end
|
||||
|
||||
test "returns 200 to authenticated request when the instance is not public",
|
||||
%{conn: conn, user: user} do
|
||||
instance =
|
||||
Application.get_env(:pleroma, :instance)
|
||||
|> Keyword.put(:public, false)
|
||||
|
||||
Application.put_env(:pleroma, :instance, instance)
|
||||
Pleroma.Config.put([:instance, :public], false)
|
||||
|
||||
conn
|
||||
|> with_credentials(user.nickname, "test")
|
||||
|> get("/api/statuses/public_timeline.json")
|
||||
|> json_response(200)
|
||||
|
||||
instance =
|
||||
Application.get_env(:pleroma, :instance)
|
||||
|> Keyword.put(:public, true)
|
||||
|
||||
Application.put_env(:pleroma, :instance, instance)
|
||||
Pleroma.Config.put([:instance, :public], true)
|
||||
end
|
||||
|
||||
test "returns 200 to unauthenticated request when the instance is public", %{conn: conn} do
|
||||
|
|
@ -238,41 +222,25 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
|
|||
setup [:valid_user]
|
||||
|
||||
test "returns 403 to unauthenticated request when the instance is not public", %{conn: conn} do
|
||||
instance =
|
||||
Application.get_env(:pleroma, :instance)
|
||||
|> Keyword.put(:public, false)
|
||||
|
||||
Application.put_env(:pleroma, :instance, instance)
|
||||
Pleroma.Config.put([:instance, :public], false)
|
||||
|
||||
conn
|
||||
|> get("/api/statuses/public_and_external_timeline.json")
|
||||
|> json_response(403)
|
||||
|
||||
instance =
|
||||
Application.get_env(:pleroma, :instance)
|
||||
|> Keyword.put(:public, true)
|
||||
|
||||
Application.put_env(:pleroma, :instance, instance)
|
||||
Pleroma.Config.put([:instance, :public], true)
|
||||
end
|
||||
|
||||
test "returns 200 to authenticated request when the instance is not public",
|
||||
%{conn: conn, user: user} do
|
||||
instance =
|
||||
Application.get_env(:pleroma, :instance)
|
||||
|> Keyword.put(:public, false)
|
||||
|
||||
Application.put_env(:pleroma, :instance, instance)
|
||||
Pleroma.Config.put([:instance, :public], false)
|
||||
|
||||
conn
|
||||
|> with_credentials(user.nickname, "test")
|
||||
|> get("/api/statuses/public_and_external_timeline.json")
|
||||
|> json_response(200)
|
||||
|
||||
instance =
|
||||
Application.get_env(:pleroma, :instance)
|
||||
|> Keyword.put(:public, true)
|
||||
|
||||
Application.put_env(:pleroma, :instance, instance)
|
||||
Pleroma.Config.put([:instance, :public], true)
|
||||
end
|
||||
|
||||
test "returns 200 to unauthenticated request when the instance is public", %{conn: conn} do
|
||||
|
|
@ -1564,7 +1532,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
|
|||
"hide_follows" => "false"
|
||||
})
|
||||
|
||||
user = Repo.get!(User, user.id)
|
||||
user = refresh_record(user)
|
||||
assert user.info.hide_follows == false
|
||||
assert json_response(conn, 200) == UserView.render("user.json", %{user: user, for: user})
|
||||
end
|
||||
|
|
@ -1617,6 +1585,29 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
|
|||
assert json_response(conn, 200) == UserView.render("user.json", %{user: user, for: user})
|
||||
end
|
||||
|
||||
test "it sets and un-sets skip_thread_containment", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
|
||||
response =
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
|> post("/api/account/update_profile.json", %{"skip_thread_containment" => "true"})
|
||||
|> json_response(200)
|
||||
|
||||
assert response["pleroma"]["skip_thread_containment"] == true
|
||||
user = refresh_record(user)
|
||||
assert user.info.skip_thread_containment
|
||||
|
||||
response =
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
|> post("/api/account/update_profile.json", %{"skip_thread_containment" => "false"})
|
||||
|> json_response(200)
|
||||
|
||||
assert response["pleroma"]["skip_thread_containment"] == false
|
||||
refute refresh_record(user).info.skip_thread_containment
|
||||
end
|
||||
|
||||
test "it locks an account", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
|
||||
|
|
|
|||
|
|
@ -116,8 +116,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
{:ok, user, followed, _activity} = TwitterAPI.follow(user, %{"user_id" => followed.id})
|
||||
assert User.ap_followers(followed) in user.following
|
||||
|
||||
{:error, msg} = TwitterAPI.follow(user, %{"user_id" => followed.id})
|
||||
assert msg == "Could not follow user: #{followed.nickname} is already on your list."
|
||||
{:ok, _, _, _} = TwitterAPI.follow(user, %{"user_id" => followed.id})
|
||||
end
|
||||
|
||||
test "Follow another user using screen_name" do
|
||||
|
|
@ -132,8 +131,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
followed = User.get_cached_by_ap_id(followed.ap_id)
|
||||
assert followed.info.follower_count == 1
|
||||
|
||||
{:error, msg} = TwitterAPI.follow(user, %{"screen_name" => followed.nickname})
|
||||
assert msg == "Could not follow user: #{followed.nickname} is already on your list."
|
||||
{:ok, _, _, _} = TwitterAPI.follow(user, %{"screen_name" => followed.nickname})
|
||||
end
|
||||
|
||||
test "Unfollow another user using user_id" do
|
||||
|
|
|
|||
|
|
@ -102,7 +102,6 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
|
|||
conn
|
||||
|> assign(:user, user)
|
||||
|> put("/api/pleroma/notification_settings", %{
|
||||
"remote" => false,
|
||||
"followers" => false,
|
||||
"bar" => 1
|
||||
})
|
||||
|
|
@ -110,8 +109,12 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
|
|||
|
||||
user = Repo.get(User, user.id)
|
||||
|
||||
assert %{"remote" => false, "local" => true, "followers" => false, "follows" => true} ==
|
||||
user.info.notification_settings
|
||||
assert %{
|
||||
"followers" => false,
|
||||
"follows" => true,
|
||||
"non_follows" => true,
|
||||
"non_followers" => true
|
||||
} == user.info.notification_settings
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"fields" => [],
|
||||
"pleroma" => %{
|
||||
"confirmation_pending" => false,
|
||||
"tags" => []
|
||||
"tags" => [],
|
||||
"skip_thread_containment" => false
|
||||
},
|
||||
"rights" => %{"admin" => false, "delete_others_notice" => false},
|
||||
"role" => "member"
|
||||
|
|
@ -112,9 +113,11 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
as_user = UserView.render("show.json", %{user: user, for: user})
|
||||
assert as_user["default_scope"] == user.info.default_scope
|
||||
assert as_user["no_rich_text"] == user.info.no_rich_text
|
||||
assert as_user["pleroma"]["notification_settings"] == user.info.notification_settings
|
||||
as_stranger = UserView.render("show.json", %{user: user})
|
||||
refute as_stranger["default_scope"]
|
||||
refute as_stranger["no_rich_text"]
|
||||
refute as_stranger["pleroma"]["notification_settings"]
|
||||
end
|
||||
|
||||
test "A user for a given other follower", %{user: user} do
|
||||
|
|
@ -152,7 +155,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"fields" => [],
|
||||
"pleroma" => %{
|
||||
"confirmation_pending" => false,
|
||||
"tags" => []
|
||||
"tags" => [],
|
||||
"skip_thread_containment" => false
|
||||
},
|
||||
"rights" => %{"admin" => false, "delete_others_notice" => false},
|
||||
"role" => "member"
|
||||
|
|
@ -197,7 +201,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"fields" => [],
|
||||
"pleroma" => %{
|
||||
"confirmation_pending" => false,
|
||||
"tags" => []
|
||||
"tags" => [],
|
||||
"skip_thread_containment" => false
|
||||
},
|
||||
"rights" => %{"admin" => false, "delete_others_notice" => false},
|
||||
"role" => "member"
|
||||
|
|
@ -279,7 +284,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"fields" => [],
|
||||
"pleroma" => %{
|
||||
"confirmation_pending" => false,
|
||||
"tags" => []
|
||||
"tags" => [],
|
||||
"skip_thread_containment" => false
|
||||
},
|
||||
"rights" => %{"admin" => false, "delete_others_notice" => false},
|
||||
"role" => "member"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue