Skip to content

Commit

Permalink
Remove unnecessary check on abilities being a list
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonkopliku committed Jan 22, 2025
1 parent 88561a9 commit d390c32
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion lib/wanda_web/auth/user_detector.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule WandaWeb.Auth.UserDetector do
alias Wanda.Users.User

def current_user(%{private: %{user_id: user_id, abilities: abilities}})
when not is_nil(user_id) and is_list(abilities) do
when not is_nil(user_id) do
%User{
id: user_id,
abilities: abilities
Expand Down
8 changes: 0 additions & 8 deletions test/wanda_web/auth/user_detector_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ defmodule WandaWeb.Auth.UserDetectorTest do
conn
|> put_private(:user_id, 1)
|> UserDetector.current_user()

for unsupported_ability <- [nil, %{}, "foo", 1, 1.0, true, false] do
assert nil ==
conn
|> put_private(:user_id, 1)
|> put_private(:abilities, unsupported_ability)
|> UserDetector.current_user()
end
end

test "should return a lite user representation", %{conn: conn} do
Expand Down

0 comments on commit d390c32

Please sign in to comment.