aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-12-03 01:28:54 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-12-03 01:28:54 +0000
commit05879a3b3ef656fd167e40e0a62c7a3c9f41facd (patch)
treea38ee456fec02bba2ef11398c38ff9f9af2e4123 /lib
parentc91ca482c2df85006d1967591730407230448316 (diff)
parent5d1548609843952bffa514af96e714756a7091ec (diff)
downloadpleroma-05879a3b3ef656fd167e40e0a62c7a3c9f41facd.tar.gz
Merge branch '2339-local-remote-mixup' into 'develop'
User: Don't allow local users in remote changesets Closes #2339 See merge request pleroma/pleroma!3185
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/user.ex12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index bcd5256c8..4b3a9d690 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -473,6 +473,18 @@ defmodule Pleroma.User do
|> validate_length(:bio, max: bio_limit)
|> validate_length(:name, max: name_limit)
|> validate_fields(true)
+ |> validate_non_local()
+ end
+
+ defp validate_non_local(cng) do
+ local? = get_field(cng, :local)
+
+ if local? do
+ cng
+ |> add_error(:local, "User is local, can't update with this changeset.")
+ else
+ cng
+ end
end
def update_changeset(struct, params \\ %{}) do