remove id cast

This commit is contained in:
rinpatch 2019-01-16 17:58:11 +03:00
parent 5a08dee379
commit 8a9f089812

View file

@ -462,19 +462,7 @@ def get_cached_by_nickname(nickname) do
end end
def get_cached_by_nickname_or_id(nickname_or_id) do def get_cached_by_nickname_or_id(nickname_or_id) do
try do get_cached_by_id(maybe_id) || get_cached_by_nickname(nickname_or_id)
# 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)
end end
end end