aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/user.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/user.ex')
-rw-r--r--lib/pleroma/user.ex11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 8c1c524ff..2ae01c2cc 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -99,7 +99,7 @@ defmodule Pleroma.User do
|> cast(params, [:bio, :name])
|> unique_constraint(:nickname)
|> validate_format(:nickname, ~r/^[a-zA-Z\d]+$/)
- |> validate_length(:bio, min: 1, max: 1000)
+ |> validate_length(:bio, min: 1, max: 5000)
|> validate_length(:name, min: 1, max: 100)
end
@@ -108,8 +108,8 @@ defmodule Pleroma.User do
|> 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)
+ |> validate_length(:bio, max: 5000)
+ |> validate_length(:name, max: 100)
end
def password_update_changeset(struct, params) do
@@ -218,6 +218,11 @@ defmodule Pleroma.User do
end
end
+ def invalidate_cache(user) do
+ Cachex.del(:user_cache, "ap_id:#{user.ap_id}")
+ Cachex.del(:user_cache, "nickname:#{user.nickname}")
+ end
+
def get_cached_by_ap_id(ap_id) do
key = "ap_id:#{ap_id}"
Cachex.get!(:user_cache, key, fallback: fn(_) -> get_by_ap_id(ap_id) end)