From: Alex S Date: Mon, 8 Apr 2019 13:08:16 +0000 (+0700) Subject: removing not needed invite update X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=fee50636d07c54328ececfe8805c658e3bb80cc6;p=akkoma removing not needed invite update --- diff --git a/lib/pleroma/user_invite_token.ex b/lib/pleroma/user_invite_token.ex index 6247831d5..86f0a5486 100644 --- a/lib/pleroma/user_invite_token.ex +++ b/lib/pleroma/user_invite_token.ex @@ -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() diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs index 798a009fe..a4540e651 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/web/twitter_api/twitter_api_test.exs @@ -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