removing not needed invite update

This commit is contained in:
Alex S 2019-04-08 20:08:16 +07:00
parent d0696fdfd6
commit fee50636d0
2 changed files with 3 additions and 4 deletions

View File

@ -96,9 +96,8 @@ defmodule Pleroma.UserInviteToken do
not_overdue_date?(invite) and invite.uses < invite.max_use and not invite.used
end
defp not_overdue_date?(%{expires_at: expires_at} = invite) do
Date.compare(Date.utc_today(), expires_at) in [:lt, :eq] ||
(update_invite!(invite, %{used: true}) && false)
defp not_overdue_date?(%{expires_at: expires_at}) do
Date.compare(Date.utc_today(), expires_at) in [:lt, :eq]
end
@spec update_usage!(UserInviteToken.t()) :: nil | UserInviteToken.t() | no_return()

View File

@ -492,7 +492,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
refute User.get_by_nickname("vinny")
invite = Repo.get_by(UserInviteToken, token: invite.token)
assert invite.used == true
refute invite.used
end
end