Get users fresh, might so we don't make new keys all the time.
authorRoger Braun <roger@rogerbraun.net>
Sun, 30 Apr 2017 13:05:16 +0000 (15:05 +0200)
committerRoger Braun <roger@rogerbraun.net>
Sun, 30 Apr 2017 13:05:16 +0000 (15:05 +0200)
lib/pleroma/user.ex
lib/pleroma/web/web_finger/web_finger.ex

index 49ba9b22ed1fa727b192e6c42044332d5450abd2..2c297433a5e8452f0a14655a23fefb4581937f3e 100644 (file)
@@ -123,6 +123,10 @@ defmodule Pleroma.User do
     Cachex.get!(:user_cache, key, fallback: fn(_) -> Repo.get_by(User, nickname: nickname) end)
   end
 
+  def get_cached_by_nickname(nickname) do
+    Repo.get_by(User, nickname: nickname)
+  end
+
   def get_cached_user_info(user) do
     key = "user_info:#{user.id}"
     Cachex.get!(:user_cache, key, fallback: fn(_) -> user_info(user) end)
index 13e3baad6b27be7d3fb8a3c4fb20fc79cd7ee0d1..7ceca042b5703d80dadb6e54241e64306ac96201 100644 (file)
@@ -20,7 +20,7 @@ defmodule Pleroma.Web.WebFinger do
     regex = ~r/(acct:)?(?<username>\w+)@#{host}/
     case Regex.named_captures(regex, resource) do
       %{"username" => username} ->
-        user = User.get_cached_by_nickname(username)
+        user = User.get_by_nickname(username)
         {:ok, represent_user(user)}
       _ -> nil
     end