From: rinpatch <rinpatch@sdf.org>
Date: Thu, 17 Jan 2019 16:00:08 +0000 (+0300)
Subject: Fix the issue with get_by_nickname never being called
X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=388ceb6a7de4a17d695b40152b5dcbfadc2eef84;p=akkoma

Fix the issue with get_by_nickname never being called
---

diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 180ef180c..13a476fd2 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -449,8 +449,13 @@ defmodule Pleroma.User do
     ap_id =
       Cachex.fetch!(:user_cache, key, fn _ ->
         user = get_by_id(id)
-        Cachex.put(:user_cache, "ap_id:#{user.ap_id}", user)
-        {:commit, user.ap_id}
+
+        if user do
+          Cachex.put(:user_cache, "ap_id:#{user.ap_id}", user)
+          {:commit, user.ap_id}
+        else
+          {:ignore, ""}
+        end
       end)
 
     get_cached_by_ap_id(ap_id)