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.ex12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index c77fd6816..207674999 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -104,7 +104,7 @@ defmodule Pleroma.User do
|> cast(params, [:bio, :name])
|> unique_constraint(:nickname)
|> validate_format(:nickname, ~r/^[a-zA-Z\d]+$/)
- |> validate_length(:bio, max: 1000)
+ |> validate_length(:bio, max: 5000)
|> validate_length(:name, min: 1, max: 100)
end
@@ -322,6 +322,16 @@ defmodule Pleroma.User do
update_and_set_cache(cs)
end
+ def decrease_note_count(%User{} = user) do
+ note_count = user.info["note_count"] || 0
+ note_count = if note_count <= 0, do: 0, else: note_count - 1
+ new_info = Map.put(user.info, "note_count", note_count)
+
+ cs = info_changeset(user, %{info: new_info})
+
+ update_and_set_cache(cs)
+ end
+
def update_note_count(%User{} = user) do
note_count_query =
from(