summaryrefslogtreecommitdiff
path: root/lib/pleroma/web/twitter_api/twitter_api.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/twitter_api/twitter_api.ex')
-rw-r--r--lib/pleroma/web/twitter_api/twitter_api.ex12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex
index db521a3ad..ab6470d78 100644
--- a/lib/pleroma/web/twitter_api/twitter_api.ex
+++ b/lib/pleroma/web/twitter_api/twitter_api.ex
@@ -216,7 +216,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
{:ok, token_record} <- Pleroma.PasswordResetToken.create_token(user) do
user
|> UserEmail.password_reset_email(token_record.token)
- |> Mailer.deliver()
+ |> Mailer.deliver_async()
else
false ->
{:error, "bad user identifier"}
@@ -229,18 +229,10 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
end
end
- def get_by_id_or_nickname(id_or_nickname) do
- if !is_integer(id_or_nickname) && :error == Integer.parse(id_or_nickname) do
- Repo.get_by(User, nickname: id_or_nickname)
- else
- Repo.get(User, id_or_nickname)
- end
- end
-
def get_user(user \\ nil, params) do
case params do
%{"user_id" => user_id} ->
- case target = get_by_id_or_nickname(user_id) do
+ case target = User.get_cached_by_nickname_or_id(user_id) do
nil ->
{:error, "No user with such user_id"}