Bit more signature debugging.
[akkoma] / lib / pleroma / user.ex
index a902c57e39553091faf1f03084e769eb8ef17f1f..8c1c524ffff8f8a60cbb28f61278c74860f75943 100644 (file)
@@ -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