[#1304] Moved all non-mutes / non-blocks fields from User.Info to User. WIP.
This commit is contained in:
parent
e3b4a3e96b
commit
10ff01acd9
88 changed files with 1069 additions and 1170 deletions
|
|
@ -153,7 +153,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
|
|||
|> json_response(200)
|
||||
|
||||
assert response["pleroma"]["skip_thread_containment"] == true
|
||||
assert refresh_record(user).info.skip_thread_containment
|
||||
assert refresh_record(user).skip_thread_containment
|
||||
end
|
||||
|
||||
test "updates the user's hide_follows status", %{conn: conn} do
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
|
||||
test "getting followers, hide_followers", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user, %{info: %{hide_followers: true}})
|
||||
other_user = insert(:user, hide_followers: true)
|
||||
{:ok, _user} = User.follow(user, other_user)
|
||||
|
||||
conn =
|
||||
|
|
@ -267,7 +267,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
|
||||
test "getting followers, hide_followers, same user requesting", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user, %{info: %{hide_followers: true}})
|
||||
other_user = insert(:user, hide_followers: true)
|
||||
{:ok, _user} = User.follow(user, other_user)
|
||||
|
||||
conn =
|
||||
|
|
@ -335,7 +335,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
end
|
||||
|
||||
test "getting following, hide_follows", %{conn: conn} do
|
||||
user = insert(:user, %{info: %{hide_follows: true}})
|
||||
user = insert(:user, hide_follows: true)
|
||||
other_user = insert(:user)
|
||||
{:ok, user} = User.follow(user, other_user)
|
||||
|
||||
|
|
@ -347,7 +347,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
end
|
||||
|
||||
test "getting following, hide_follows, same user requesting", %{conn: conn} do
|
||||
user = insert(:user, %{info: %{hide_follows: true}})
|
||||
user = insert(:user, hide_follows: true)
|
||||
other_user = insert(:user)
|
||||
{:ok, user} = User.follow(user, other_user)
|
||||
|
||||
|
|
@ -669,7 +669,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
token_from_db = Repo.preload(token_from_db, :user)
|
||||
assert token_from_db.user
|
||||
|
||||
assert token_from_db.user.info.confirmation_pending
|
||||
assert token_from_db.user.confirmation_pending
|
||||
end
|
||||
|
||||
test "returns error when user already registred", %{conn: conn, valid_params: valid_params} do
|
||||
|
|
@ -713,7 +713,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
token_from_db = Repo.preload(token_from_db, :user)
|
||||
assert token_from_db.user
|
||||
|
||||
assert token_from_db.user.info.confirmation_pending
|
||||
assert token_from_db.user.confirmation_pending
|
||||
end
|
||||
|
||||
conn =
|
||||
|
|
@ -798,7 +798,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
end
|
||||
|
||||
test "verify_credentials default scope unlisted", %{conn: conn} do
|
||||
user = insert(:user, %{info: %User.Info{default_scope: "unlisted"}})
|
||||
user = insert(:user, default_scope: "unlisted")
|
||||
|
||||
conn =
|
||||
conn
|
||||
|
|
@ -810,7 +810,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
end
|
||||
|
||||
test "locked accounts", %{conn: conn} do
|
||||
user = insert(:user, %{info: %User.Info{default_scope: "private"}})
|
||||
user = insert(:user, default_scope: "private")
|
||||
|
||||
conn =
|
||||
conn
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
|
||||
{:ok, user_two} = User.follow(user_two, user_one)
|
||||
|
||||
assert User.get_cached_by_id(user_two.id).info.unread_conversation_count == 0
|
||||
assert User.get_cached_by_id(user_two.id).unread_conversation_count == 0
|
||||
|
||||
{:ok, direct} =
|
||||
CommonAPI.post(user_one, %{
|
||||
|
|
@ -25,7 +25,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
"visibility" => "direct"
|
||||
})
|
||||
|
||||
assert User.get_cached_by_id(user_two.id).info.unread_conversation_count == 1
|
||||
assert User.get_cached_by_id(user_two.id).unread_conversation_count == 1
|
||||
|
||||
{:ok, _follower_only} =
|
||||
CommonAPI.post(user_one, %{
|
||||
|
|
@ -56,7 +56,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
assert is_binary(res_id)
|
||||
assert unread == true
|
||||
assert res_last_status["id"] == direct.id
|
||||
assert User.get_cached_by_id(user_one.id).info.unread_conversation_count == 1
|
||||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 1
|
||||
end
|
||||
|
||||
test "updates the last_status on reply", %{conn: conn} do
|
||||
|
|
@ -107,7 +107,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
|> post("/api/v1/conversations/#{direct_conversation_id}/read")
|
||||
|> json_response(200)
|
||||
|
||||
assert User.get_cached_by_id(user_one.id).info.unread_conversation_count == 0
|
||||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 0
|
||||
|
||||
# The conversation is marked as unread on reply
|
||||
{:ok, _} =
|
||||
|
|
@ -123,7 +123,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
|> get("/api/v1/conversations")
|
||||
|> json_response(200)
|
||||
|
||||
assert User.get_cached_by_id(user_one.id).info.unread_conversation_count == 1
|
||||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 1
|
||||
|
||||
# A reply doesn't increment the user's unread_conversation_count if the conversation is unread
|
||||
{:ok, _} =
|
||||
|
|
@ -133,7 +133,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
"in_reply_to_status_id" => direct.id
|
||||
})
|
||||
|
||||
assert User.get_cached_by_id(user_one.id).info.unread_conversation_count == 1
|
||||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 1
|
||||
end
|
||||
|
||||
test "(vanilla) Mastodon frontend behaviour", %{conn: conn} do
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
|
|||
|
||||
describe "locked accounts" do
|
||||
test "/api/v1/follow_requests works" do
|
||||
user = insert(:user, %{info: %User.Info{locked: true}})
|
||||
user = insert(:user, locked: true)
|
||||
other_user = insert(:user)
|
||||
|
||||
{:ok, _activity} = ActivityPub.follow(other_user, user)
|
||||
|
|
@ -32,7 +32,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
|
|||
end
|
||||
|
||||
test "/api/v1/follow_requests/:id/authorize works" do
|
||||
user = insert(:user, %{info: %User.Info{locked: true}})
|
||||
user = insert(:user, locked: true)
|
||||
other_user = insert(:user)
|
||||
|
||||
{:ok, _activity} = ActivityPub.follow(other_user, user)
|
||||
|
|
@ -57,7 +57,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
|
|||
end
|
||||
|
||||
test "/api/v1/follow_requests/:id/reject works" do
|
||||
user = insert(:user, %{info: %User.Info{locked: true}})
|
||||
user = insert(:user, locked: true)
|
||||
other_user = insert(:user)
|
||||
|
||||
{:ok, _activity} = ActivityPub.follow(other_user, user)
|
||||
|
|
|
|||
|
|
@ -41,20 +41,13 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
|
|||
user = insert(:user, %{local: true})
|
||||
|
||||
user2 = insert(:user, %{local: true})
|
||||
{:ok, _user2} = User.deactivate(user2, !user2.info.deactivated)
|
||||
{:ok, _user2} = User.deactivate(user2, !user2.deactivated)
|
||||
|
||||
insert(:user, %{local: false, nickname: "u@peer1.com"})
|
||||
insert(:user, %{local: false, nickname: "u@peer2.com"})
|
||||
|
||||
{:ok, _} = Pleroma.Web.CommonAPI.post(user, %{"status" => "cofe"})
|
||||
|
||||
# Stats should count users with missing or nil `info.deactivated` value
|
||||
|
||||
{:ok, _user} =
|
||||
user.id
|
||||
|> User.get_cached_by_id()
|
||||
|> User.update_info(&Ecto.Changeset.change(&1, %{deactivated: nil}))
|
||||
|
||||
Pleroma.Stats.force_update()
|
||||
|
||||
conn = get(conn, "/api/v1/instance")
|
||||
|
|
|
|||
|
|
@ -526,8 +526,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
test "when you're an admin or moderator", %{conn: conn} do
|
||||
activity1 = insert(:note_activity)
|
||||
activity2 = insert(:note_activity)
|
||||
admin = insert(:user, info: %{is_admin: true})
|
||||
moderator = insert(:user, info: %{is_moderator: true})
|
||||
admin = insert(:user, is_admin: true)
|
||||
moderator = insert(:user, is_moderator: true)
|
||||
|
||||
res_conn =
|
||||
conn
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue