remove id cast
This commit is contained in:
parent
5a08dee379
commit
8a9f089812
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue