Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel
This commit is contained in:
commit
e9993acdbb
157 changed files with 6150 additions and 1624 deletions
|
|
@ -103,6 +103,21 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
|
|||
assert user["locked"] == true
|
||||
end
|
||||
|
||||
test "updates the user's allow_following_move", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
|
||||
assert user.allow_following_move == true
|
||||
|
||||
conn =
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
|> patch("/api/v1/accounts/update_credentials", %{allow_following_move: "false"})
|
||||
|
||||
assert refresh_record(user).allow_following_move == false
|
||||
assert user = json_response(conn, 200)
|
||||
assert user["pleroma"]["allow_following_move"] == false
|
||||
end
|
||||
|
||||
test "updates the user's default scope", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
alias Pleroma.Repo
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||
alias Pleroma.Web.ActivityPub.InternalFetchActor
|
||||
alias Pleroma.Web.CommonAPI
|
||||
alias Pleroma.Web.OAuth.Token
|
||||
|
||||
|
|
@ -118,6 +119,28 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
refute acc_one == acc_two
|
||||
assert acc_two == acc_three
|
||||
end
|
||||
|
||||
test "returns 404 when user is invisible", %{conn: conn} do
|
||||
user = insert(:user, %{invisible: true})
|
||||
|
||||
resp =
|
||||
conn
|
||||
|> get("/api/v1/accounts/#{user.nickname}")
|
||||
|> json_response(404)
|
||||
|
||||
assert %{"error" => "Can't find user"} = resp
|
||||
end
|
||||
|
||||
test "returns 404 for internal.fetch actor", %{conn: conn} do
|
||||
%User{nickname: "internal.fetch"} = InternalFetchActor.get_actor()
|
||||
|
||||
resp =
|
||||
conn
|
||||
|> get("/api/v1/accounts/internal.fetch")
|
||||
|> json_response(404)
|
||||
|
||||
assert %{"error" => "Can't find user"} = resp
|
||||
end
|
||||
end
|
||||
|
||||
describe "user timelines" do
|
||||
|
|
|
|||
|
|
@ -59,6 +59,59 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 0
|
||||
end
|
||||
|
||||
test "filters conversations by recipients", %{conn: conn} do
|
||||
user_one = insert(:user)
|
||||
user_two = insert(:user)
|
||||
user_three = insert(:user)
|
||||
|
||||
{:ok, direct1} =
|
||||
CommonAPI.post(user_one, %{
|
||||
"status" => "Hi @#{user_two.nickname}!",
|
||||
"visibility" => "direct"
|
||||
})
|
||||
|
||||
{:ok, _direct2} =
|
||||
CommonAPI.post(user_one, %{
|
||||
"status" => "Hi @#{user_three.nickname}!",
|
||||
"visibility" => "direct"
|
||||
})
|
||||
|
||||
{:ok, direct3} =
|
||||
CommonAPI.post(user_one, %{
|
||||
"status" => "Hi @#{user_two.nickname}, @#{user_three.nickname}!",
|
||||
"visibility" => "direct"
|
||||
})
|
||||
|
||||
{:ok, _direct4} =
|
||||
CommonAPI.post(user_two, %{
|
||||
"status" => "Hi @#{user_three.nickname}!",
|
||||
"visibility" => "direct"
|
||||
})
|
||||
|
||||
{:ok, direct5} =
|
||||
CommonAPI.post(user_two, %{
|
||||
"status" => "Hi @#{user_one.nickname}!",
|
||||
"visibility" => "direct"
|
||||
})
|
||||
|
||||
[conversation1, conversation2] =
|
||||
conn
|
||||
|> assign(:user, user_one)
|
||||
|> get("/api/v1/conversations", %{"recipients" => [user_two.id]})
|
||||
|> json_response(200)
|
||||
|
||||
assert conversation1["last_status"]["id"] == direct5.id
|
||||
assert conversation2["last_status"]["id"] == direct1.id
|
||||
|
||||
[conversation1] =
|
||||
conn
|
||||
|> assign(:user, user_one)
|
||||
|> get("/api/v1/conversations", %{"recipients" => [user_two.id, user_three.id]})
|
||||
|> json_response(200)
|
||||
|
||||
assert conversation1["last_status"]["id"] == direct3.id
|
||||
end
|
||||
|
||||
test "updates the last_status on reply", %{conn: conn} do
|
||||
user_one = insert(:user)
|
||||
user_two = insert(:user)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
|
||||
use Pleroma.Web.ConnCase, async: true
|
||||
use Pleroma.Web.ConnCase
|
||||
|
||||
alias Pleroma.Web.MastodonAPI.FilterView
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.MastodonAPI.ScheduledActivityControllerTest do
|
||||
use Pleroma.Web.ConnCase, async: true
|
||||
use Pleroma.Web.ConnCase
|
||||
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.ScheduledActivity
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue