summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-10-14 16:17:32 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-10-14 16:17:32 +0000
commit9a85ec0da095933cbddfb1dae74d035723032399 (patch)
treed23745d29bdc0de246b1fefa97eb04947ca971e5
parent481906207e6d803e5c4d3e455c7b93119e392177 (diff)
parented61002815a65962cd4eba8522f090c2998741d4 (diff)
Merge branch 'refactor/locked_user_field' into 'develop'
Change user.locked field to user.is_locked See merge request pleroma/pleroma!3077
-rw-r--r--lib/mix/tasks/pleroma/user.ex6
-rw-r--r--lib/pleroma/user.ex12
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex4
-rw-r--r--lib/pleroma/web/activity_pub/side_effects.ex2
-rw-r--r--lib/pleroma/web/activity_pub/views/user_view.ex2
-rw-r--r--lib/pleroma/web/admin_api/views/account_view.ex2
-rw-r--r--lib/pleroma/web/api_spec/schemas/chat.ex2
-rw-r--r--lib/pleroma/web/api_spec/schemas/status.ex2
-rw-r--r--lib/pleroma/web/mastodon_api/controllers/account_controller.ex2
-rw-r--r--lib/pleroma/web/mastodon_api/views/account_view.ex2
-rw-r--r--priv/repo/migrations/20201013141127_refactor_locked_user_field.exs15
-rw-r--r--test/mix/tasks/pleroma/user_test.exs11
-rw-r--r--test/pleroma/notification_test.exs8
-rw-r--r--test/pleroma/user_test.exs18
-rw-r--r--test/pleroma/web/activity_pub/activity_pub_test.exs2
-rw-r--r--test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs4
-rw-r--r--test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs4
-rw-r--r--test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs4
-rw-r--r--test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs2
-rw-r--r--test/pleroma/web/activity_pub/utils_test.exs4
-rw-r--r--test/pleroma/web/common_api_test.exs10
-rw-r--r--test/pleroma/web/mastodon_api/controllers/account_controller_test.exs2
-rw-r--r--test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs2
-rw-r--r--test/pleroma/web/mastodon_api/views/account_view_test.exs12
24 files changed, 77 insertions, 57 deletions
diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex
index e06262804..a8d251411 100644
--- a/lib/mix/tasks/pleroma/user.ex
+++ b/lib/mix/tasks/pleroma/user.ex
@@ -419,7 +419,7 @@ defmodule Mix.Tasks.Pleroma.User do
|> Enum.each(fn user ->
shell_info(
"#{user.nickname} moderator: #{user.is_moderator}, admin: #{user.is_admin}, locked: #{
- user.locked
+ user.is_locked
}, deactivated: #{user.deactivated}"
)
end)
@@ -447,10 +447,10 @@ defmodule Mix.Tasks.Pleroma.User do
defp set_locked(user, value) do
{:ok, user} =
user
- |> Changeset.change(%{locked: value})
+ |> Changeset.change(%{is_locked: value})
|> User.update_and_set_cache()
- shell_info("Locked status of #{user.nickname}: #{user.locked}")
+ shell_info("Locked status of #{user.nickname}: #{user.is_locked}")
user
end
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 09ea80793..87c8bfbd1 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -107,7 +107,7 @@ defmodule Pleroma.User do
field(:note_count, :integer, default: 0)
field(:follower_count, :integer, default: 0)
field(:following_count, :integer, default: 0)
- field(:locked, :boolean, default: false)
+ field(:is_locked, :boolean, default: false)
field(:confirmation_pending, :boolean, default: false)
field(:password_reset_pending, :boolean, default: false)
field(:approval_pending, :boolean, default: false)
@@ -436,7 +436,7 @@ defmodule Pleroma.User do
:avatar,
:ap_enabled,
:banner,
- :locked,
+ :is_locked,
:last_refreshed_at,
:uri,
:follower_address,
@@ -479,7 +479,7 @@ defmodule Pleroma.User do
:public_key,
:inbox,
:shared_inbox,
- :locked,
+ :is_locked,
:no_rich_text,
:default_scope,
:banner,
@@ -847,7 +847,7 @@ defmodule Pleroma.User do
@spec maybe_direct_follow(User.t(), User.t()) :: {:ok, User.t()} | {:error, String.t()}
# "Locked" (self-locked) users demand explicit authorization of follow requests
- def maybe_direct_follow(%User{} = follower, %User{local: true, locked: true} = followed) do
+ def maybe_direct_follow(%User{} = follower, %User{local: true, is_locked: true} = followed) do
follow(follower, followed, :follow_pending)
end
@@ -954,7 +954,7 @@ defmodule Pleroma.User do
end
def locked?(%User{} = user) do
- user.locked || false
+ user.is_locked || false
end
def get_by_id(id) do
@@ -1601,7 +1601,7 @@ defmodule Pleroma.User do
note_count: 0,
follower_count: 0,
following_count: 0,
- locked: false,
+ is_locked: false,
confirmation_pending: false,
password_reset_pending: false,
approval_pending: false,
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index eb44cffec..8022f0402 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -1228,7 +1228,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
{String.trim(name, ":"), url}
end)
- locked = data["manuallyApprovesFollowers"] || false
+ is_locked = data["manuallyApprovesFollowers"] || false
capabilities = data["capabilities"] || %{}
accepts_chat_messages = capabilities["acceptsChatMessages"]
data = Transmogrifier.maybe_fix_user_object(data)
@@ -1257,7 +1257,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
banner: banner,
fields: fields,
emoji: emojis,
- locked: locked,
+ is_locked: is_locked,
discoverable: discoverable,
invisible: invisible,
avatar: avatar,
diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex
index 2eec0ce86..d421ca7af 100644
--- a/lib/pleroma/web/activity_pub/side_effects.ex
+++ b/lib/pleroma/web/activity_pub/side_effects.ex
@@ -102,7 +102,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
%User{} = followed <- User.get_cached_by_ap_id(followed_user),
{_, {:ok, _}, _, _} <-
{:following, User.follow(follower, followed, :follow_pending), follower, followed} do
- if followed.local && !followed.locked do
+ if followed.local && !followed.is_locked do
{:ok, accept_data, _} = Builder.accept(followed, object)
{:ok, _activity, _} = Pipeline.common_pipeline(accept_data, local: true)
end
diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex
index 3a4564912..c6dee61db 100644
--- a/lib/pleroma/web/activity_pub/views/user_view.ex
+++ b/lib/pleroma/web/activity_pub/views/user_view.ex
@@ -101,7 +101,7 @@ defmodule Pleroma.Web.ActivityPub.UserView do
"name" => user.name,
"summary" => user.bio,
"url" => user.ap_id,
- "manuallyApprovesFollowers" => user.locked,
+ "manuallyApprovesFollowers" => user.is_locked,
"publicKey" => %{
"id" => "#{user.ap_id}#main-key",
"owner" => user.ap_id,
diff --git a/lib/pleroma/web/admin_api/views/account_view.ex b/lib/pleroma/web/admin_api/views/account_view.ex
index 9c477feab..bda7ea19c 100644
--- a/lib/pleroma/web/admin_api/views/account_view.ex
+++ b/lib/pleroma/web/admin_api/views/account_view.ex
@@ -39,7 +39,7 @@ defmodule Pleroma.Web.AdminAPI.AccountView do
:fields,
:name,
:nickname,
- :locked,
+ :is_locked,
:no_rich_text,
:default_scope,
:hide_follows,
diff --git a/lib/pleroma/web/api_spec/schemas/chat.ex b/lib/pleroma/web/api_spec/schemas/chat.ex
index b4986b734..65f908e33 100644
--- a/lib/pleroma/web/api_spec/schemas/chat.ex
+++ b/lib/pleroma/web/api_spec/schemas/chat.ex
@@ -50,7 +50,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Chat do
"fields" => []
},
"statuses_count" => 1,
- "locked" => false,
+ "is_locked" => false,
"created_at" => "2020-04-16T13:40:15.000Z",
"display_name" => "lain",
"fields" => [],
diff --git a/lib/pleroma/web/api_spec/schemas/status.ex b/lib/pleroma/web/api_spec/schemas/status.ex
index 947e42890..e6890df2d 100644
--- a/lib/pleroma/web/api_spec/schemas/status.ex
+++ b/lib/pleroma/web/api_spec/schemas/status.ex
@@ -252,7 +252,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
"header" => "http://localhost:4001/images/banner.png",
"header_static" => "http://localhost:4001/images/banner.png",
"id" => "9toJCsKN7SmSf3aj5c",
- "locked" => false,
+ "is_locked" => false,
"note" => "Tester Number 6",
"pleroma" => %{
"background_image" => nil,
diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
index 4f9696d52..97858a93c 100644
--- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
+++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
@@ -177,7 +177,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
user_params =
[
:no_rich_text,
- :locked,
:hide_followers_count,
:hide_follows_count,
:hide_followers,
@@ -210,6 +209,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
if bot, do: {:ok, "Service"}, else: {:ok, "Person"}
end)
|> Maps.put_if_present(:actor_type, params[:actor_type])
+ |> Maps.put_if_present(:is_locked, params[:locked])
# What happens here:
#
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex
index 121ba1693..d54cae732 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -242,7 +242,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
username: username_from_nickname(user.nickname),
acct: user.nickname,
display_name: display_name,
- locked: user.locked,
+ locked: user.is_locked,
created_at: Utils.to_masto_date(user.inserted_at),
followers_count: followers_count,
following_count: following_count,
diff --git a/priv/repo/migrations/20201013141127_refactor_locked_user_field.exs b/priv/repo/migrations/20201013141127_refactor_locked_user_field.exs
new file mode 100644
index 000000000..6cd23dbac
--- /dev/null
+++ b/priv/repo/migrations/20201013141127_refactor_locked_user_field.exs
@@ -0,0 +1,15 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.RefactorLockedUserField do
+ use Ecto.Migration
+
+ def up do
+ execute("ALTER TABLE users RENAME COLUMN locked TO is_locked;")
+ end
+
+ def down do
+ execute("ALTER TABLE users RENAME COLUMN is_locked TO locked;")
+ end
+end
diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs
index b8c423c48..ce819f815 100644
--- a/test/mix/tasks/pleroma/user_test.exs
+++ b/test/mix/tasks/pleroma/user_test.exs
@@ -248,14 +248,19 @@ defmodule Mix.Tasks.Pleroma.UserTest do
user = User.get_cached_by_nickname(user.nickname)
assert user.is_moderator
- assert user.locked
+ assert user.is_locked
assert user.is_admin
refute user.confirmation_pending
end
test "All statuses unset" do
user =
- insert(:user, locked: true, is_moderator: true, is_admin: true, confirmation_pending: true)
+ insert(:user,
+ is_locked: true,
+ is_moderator: true,
+ is_admin: true,
+ confirmation_pending: true
+ )
Mix.Tasks.Pleroma.User.run([
"set",
@@ -280,7 +285,7 @@ defmodule Mix.Tasks.Pleroma.UserTest do
user = User.get_cached_by_nickname(user.nickname)
refute user.is_moderator
- refute user.locked
+ refute user.is_locked
refute user.is_admin
assert user.confirmation_pending
end
diff --git a/test/pleroma/notification_test.exs b/test/pleroma/notification_test.exs
index f2e0f0b0d..0e9630f28 100644
--- a/test/pleroma/notification_test.exs
+++ b/test/pleroma/notification_test.exs
@@ -346,7 +346,7 @@ defmodule Pleroma.NotificationTest do
describe "follow / follow_request notifications" do
test "it creates `follow` notification for approved Follow activity" do
user = insert(:user)
- followed_user = insert(:user, locked: false)
+ followed_user = insert(:user, is_locked: false)
{:ok, _, _, _activity} = CommonAPI.follow(user, followed_user)
assert FollowingRelationship.following?(user, followed_user)
@@ -361,7 +361,7 @@ defmodule Pleroma.NotificationTest do
test "it creates `follow_request` notification for pending Follow activity" do
user = insert(:user)
- followed_user = insert(:user, locked: true)
+ followed_user = insert(:user, is_locked: true)
{:ok, _, _, _activity} = CommonAPI.follow(user, followed_user)
refute FollowingRelationship.following?(user, followed_user)
@@ -383,7 +383,7 @@ defmodule Pleroma.NotificationTest do
test "it doesn't create a notification for follow-unfollow-follow chains" do
user = insert(:user)
- followed_user = insert(:user, locked: false)
+ followed_user = insert(:user, is_locked: false)
{:ok, _, _, _activity} = CommonAPI.follow(user, followed_user)
assert FollowingRelationship.following?(user, followed_user)
@@ -397,7 +397,7 @@ defmodule Pleroma.NotificationTest do
end
test "dismisses the notification on follow request rejection" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
follower = insert(:user)
{:ok, _, _, _follow_activity} = CommonAPI.follow(follower, user)
assert [notification] = Notification.for_user(user)
diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs
index d506f7047..d8ac652af 100644
--- a/test/pleroma/user_test.exs
+++ b/test/pleroma/user_test.exs
@@ -174,7 +174,7 @@ defmodule Pleroma.UserTest do
test "returns all pending follow requests" do
unlocked = insert(:user)
- locked = insert(:user, locked: true)
+ locked = insert(:user, is_locked: true)
follower = insert(:user)
CommonAPI.follow(follower, unlocked)
@@ -187,7 +187,7 @@ defmodule Pleroma.UserTest do
end
test "doesn't return already accepted or duplicate follow requests" do
- locked = insert(:user, locked: true)
+ locked = insert(:user, is_locked: true)
pending_follower = insert(:user)
accepted_follower = insert(:user)
@@ -201,7 +201,7 @@ defmodule Pleroma.UserTest do
end
test "doesn't return follow requests for deactivated accounts" do
- locked = insert(:user, locked: true)
+ locked = insert(:user, is_locked: true)
pending_follower = insert(:user, %{deactivated: true})
CommonAPI.follow(pending_follower, locked)
@@ -211,7 +211,7 @@ defmodule Pleroma.UserTest do
end
test "clears follow requests when requester is blocked" do
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
follower = insert(:user)
CommonAPI.follow(follower, followed)
@@ -299,8 +299,8 @@ defmodule Pleroma.UserTest do
end
test "local users do not automatically follow local locked accounts" do
- follower = insert(:user, locked: true)
- followed = insert(:user, locked: true)
+ follower = insert(:user, is_locked: true)
+ followed = insert(:user, is_locked: true)
{:ok, follower} = User.maybe_direct_follow(follower, followed)
@@ -1360,7 +1360,7 @@ defmodule Pleroma.UserTest do
follower = insert(:user)
{:ok, follower} = User.follow(follower, user)
- locked_user = insert(:user, name: "locked", locked: true)
+ locked_user = insert(:user, name: "locked", is_locked: true)
{:ok, _} = User.follow(user, locked_user, :follow_pending)
object = insert(:note, user: user)
@@ -1450,7 +1450,7 @@ defmodule Pleroma.UserTest do
note_count: 9,
follower_count: 9,
following_count: 9001,
- locked: true,
+ is_locked: true,
confirmation_pending: true,
password_reset_pending: true,
approval_pending: true,
@@ -1492,7 +1492,7 @@ defmodule Pleroma.UserTest do
note_count: 0,
follower_count: 0,
following_count: 0,
- locked: false,
+ is_locked: false,
confirmation_pending: false,
password_reset_pending: false,
approval_pending: false,
diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs
index 804305a13..3efc0d1b4 100644
--- a/test/pleroma/web/activity_pub/activity_pub_test.exs
+++ b/test/pleroma/web/activity_pub/activity_pub_test.exs
@@ -1120,7 +1120,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
test "creates an undo activity for a pending follow request" do
follower = insert(:user)
- followed = insert(:user, %{locked: true})
+ followed = insert(:user, %{is_locked: true})
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
{:ok, activity} = ActivityPub.unfollow(follower, followed)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs
index 77d468f5c..c6ff96f08 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs
@@ -46,7 +46,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AcceptHandlingTest do
test "it works for incoming accepts which are referenced by IRI only" do
follower = insert(:user)
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
@@ -72,7 +72,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AcceptHandlingTest do
test "it fails for incoming accepts which cannot be correlated" do
follower = insert(:user)
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
accept_data =
File.read!("test/fixtures/mastodon-accept-activity.json")
diff --git a/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs
index 757d90941..4ef8210ad 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs
@@ -65,7 +65,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.FollowHandlingTest do
end
test "with locked accounts, it does create a Follow, but not an Accept" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
@@ -188,7 +188,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.FollowHandlingTest do
test "it works for incoming follows to locked account" do
pending_follower = insert(:user, ap_id: "http://mastodon.example.org/users/admin")
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
diff --git a/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs
index 7592fbe1c..5c1451def 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs
@@ -14,7 +14,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.RejectHandlingTest do
test "it fails for incoming rejects which cannot be correlated" do
follower = insert(:user)
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
accept_data =
File.read!("test/fixtures/mastodon-reject-activity.json")
@@ -33,7 +33,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.RejectHandlingTest do
test "it works for incoming rejects which are referenced by IRI only" do
follower = insert(:user)
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
{:ok, follower} = User.follow(follower, followed)
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs
index 64636656c..7c4d16db7 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs
@@ -154,6 +154,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.UserUpdateHandlingTest do
{:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(update_data)
user = User.get_cached_by_ap_id(user.ap_id)
- assert user.locked == true
+ assert user.is_locked == true
end
end
diff --git a/test/pleroma/web/activity_pub/utils_test.exs b/test/pleroma/web/activity_pub/utils_test.exs
index d50213545..be9cd7d13 100644
--- a/test/pleroma/web/activity_pub/utils_test.exs
+++ b/test/pleroma/web/activity_pub/utils_test.exs
@@ -193,7 +193,7 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
describe "update_follow_state_for_all/2" do
test "updates the state of all Follow activities with the same actor and object" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
follower = insert(:user)
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, user)
@@ -217,7 +217,7 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
describe "update_follow_state/2" do
test "updates the state of the given follow activity" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
follower = insert(:user)
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, user)
diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs
index e34f5a49b..a8e22d44f 100644
--- a/test/pleroma/web/common_api_test.exs
+++ b/test/pleroma/web/common_api_test.exs
@@ -1071,7 +1071,7 @@ defmodule Pleroma.Web.CommonAPITest do
test "cancels a pending follow for a local user" do
follower = insert(:user)
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
CommonAPI.follow(follower, followed)
@@ -1093,7 +1093,7 @@ defmodule Pleroma.Web.CommonAPITest do
test "cancels a pending follow for a remote user" do
follower = insert(:user)
- followed = insert(:user, locked: true, local: false, ap_enabled: true)
+ followed = insert(:user, is_locked: true, local: false, ap_enabled: true)
assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
CommonAPI.follow(follower, followed)
@@ -1116,7 +1116,7 @@ defmodule Pleroma.Web.CommonAPITest do
describe "accept_follow_request/2" do
test "after acceptance, it sets all existing pending follow request states to 'accept'" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
follower = insert(:user)
follower_two = insert(:user)
@@ -1136,7 +1136,7 @@ defmodule Pleroma.Web.CommonAPITest do
end
test "after rejection, it sets all existing pending follow request states to 'reject'" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
follower = insert(:user)
follower_two = insert(:user)
@@ -1156,7 +1156,7 @@ defmodule Pleroma.Web.CommonAPITest do
end
test "doesn't create a following relationship if the corresponding follow request doesn't exist" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
not_follower = insert(:user)
CommonAPI.accept_follow_request(not_follower, user)
diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
index f7f1369e4..0b803b7ab 100644
--- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
@@ -706,7 +706,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
end
test "cancelling follow request", %{conn: conn} do
- %{id: other_user_id} = insert(:user, %{locked: true})
+ %{id: other_user_id} = insert(:user, %{is_locked: true})
assert %{"id" => ^other_user_id, "following" => false, "requested" => true} =
conn
diff --git a/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs
index 6749e0e83..a9dd7cd30 100644
--- a/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs
@@ -12,7 +12,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
describe "locked accounts" do
setup do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
%{conn: conn} = oauth_access(["follow"], user: user)
%{user: user, conn: conn}
end
diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs
index a5f39b215..203e61c71 100644
--- a/test/pleroma/web/mastodon_api/views/account_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs
@@ -332,7 +332,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
test "represent a relationship for the user with a pending follow request" do
user = insert(:user)
- other_user = insert(:user, locked: true)
+ other_user = insert(:user, is_locked: true)
{:ok, user, other_user, _} = CommonAPI.follow(user, other_user)
user = User.get_cached_by_id(user.id)
@@ -481,7 +481,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
end
test "shows non-zero when follow requests are pending" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
@@ -493,7 +493,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
end
test "decreases when accepting a follow request" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
@@ -510,7 +510,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
end
test "decreases when rejecting a follow request" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
@@ -527,14 +527,14 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
end
test "shows non-zero when historical unapproved requests are present" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
other_user = insert(:user)
{:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user)
- {:ok, user} = User.update_and_set_cache(user, %{locked: false})
+ {:ok, user} = User.update_and_set_cache(user, %{is_locked: false})
assert %{locked: false, follow_requests_count: 1} =
AccountView.render("show.json", %{user: user, for: user})