remove id cast
authorrinpatch <rinpatch@sdf.org>
Wed, 16 Jan 2019 14:58:11 +0000 (17:58 +0300)
committerrinpatch <rinpatch@sdf.org>
Wed, 16 Jan 2019 14:58:11 +0000 (17:58 +0300)
lib/pleroma/user.ex

index 3becd545c34503f3aaca45f9664a4dbf93d264ea..fdc552f7513b07a892e77228edc4a90797be9753 100644 (file)
@@ -462,19 +462,7 @@ defmodule Pleroma.User do
   end
 
   def get_cached_by_nickname_or_id(nickname_or_id) do
-    try do
-      # TODO: convert to UUIDs when !654 is merged
-      maybe_id = String.to_integer(nickname_or_id)
-      user = get_cached_by_id(maybe_id)
-
-      if user == nil do
-        raise ArgumentError, message: "No such user id"
-      else
-        user
-      end
-    rescue
-      ArgumentError ->
-        get_cached_by_nickname(nickname_or_id)
+      get_cached_by_id(maybe_id) || get_cached_by_nickname(nickname_or_id)
     end
   end