Skip to content

Commit 5535611

Browse files
committed
fix: relax pattern matching for handle and url functions to accept any map
1 parent 28f1f2d commit 5535611

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/algora/accounts/schemas/user.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,10 @@ defmodule Algora.Accounts.User do
300300
defp type_from_provider(:github, "Organization"), do: :organization
301301
defp type_from_provider(:github, _), do: :individual
302302

303-
def handle(%User{handle: handle}), do: handle
304-
def handle(%User{provider_login: handle}), do: handle
303+
def handle(%{handle: handle}), do: handle
304+
def handle(%{provider_login: handle}), do: handle
305305

306-
def url(%User{handle: handle, type: :individual}), do: "/@/#{handle}"
307-
def url(%User{handle: handle, type: :organization}), do: "/org/#{handle}"
308-
def url(%User{provider_login: handle}), do: "https://github.com/#{handle}"
306+
def url(%{handle: handle, type: :individual}), do: "/@/#{handle}"
307+
def url(%{handle: handle, type: :organization}), do: "/org/#{handle}"
308+
def url(%{provider_login: handle}), do: "https://github.com/#{handle}"
309309
end

0 commit comments

Comments
 (0)