Fix note counting.

This commit is contained in:
lain 2018-11-18 18:17:56 +01:00
commit 5c8f07f0a8
3 changed files with 23 additions and 18 deletions

View file

@ -24,4 +24,12 @@ defmodule Pleroma.User.Info do
|> cast(params, [:deactivated])
|> validate_required([:deactivated])
end
def add_to_note_count(info, number) do
params = %{note_count: Enum.max([0, info.note_count + number])}
info
|> cast(params, [:note_count])
|> validate_required([:note_count])
end
end