Fix note counting.
This commit is contained in:
parent
47d883d3ab
commit
5c8f07f0a8
3 changed files with 23 additions and 18 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue