X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fuser.ex;h=8c1c524ffff8f8a60cbb28f61278c74860f75943;hb=fb5add56fad1fba70111f8d72e0225517febb12a;hp=a902c57e39553091faf1f03084e769eb8ef17f1f;hpb=f48bc5c3e1507c485d0515a4800e2123f848705f;p=akkoma diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index a902c57e3..8c1c524ff 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -103,6 +103,15 @@ defmodule Pleroma.User do |> validate_length(:name, min: 1, max: 100) end + def upgrade_changeset(struct, params \\ %{}) do + struct + |> cast(params, [:bio, :name, :info, :follower_address, :avatar]) + |> unique_constraint(:nickname) + |> validate_format(:nickname, ~r/^[a-zA-Z\d]+$/) + |> validate_length(:bio, min: 1, max: 1000) + |> validate_length(:name, min: 1, max: 100) + end + def password_update_changeset(struct, params) do changeset = struct |> cast(params, [:password, :password_confirmation]) @@ -314,7 +323,7 @@ defmodule Pleroma.User do def get_recipients_from_activity(%Activity{recipients: to}) do query = from u in User, where: u.ap_id in ^to, - or_where: fragment("? \\\?| ?", u.following, ^to) + or_where: fragment("? && ?", u.following, ^to) query = from u in query, where: u.local == true