fix: treat URL with only custom fields as valid in ?fields= mode
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/promote/production Build is passing

Consider visible custom fields in compute_final_field_selection so that
a link with only custom_field_X is not wrongly treated as invalid and
reverted to session/global. Add test for URL containing only custom field.
This commit is contained in:
Moritz 2026-02-24 09:42:10 +01:00
parent d5df2338a7
commit 10ad32eb6f
Signed by: moritz
GPG key ID: 1020A035E5DD0824
2 changed files with 15 additions and 2 deletions

View file

@ -361,6 +361,18 @@ defmodule MvWeb.MemberLive.IndexFieldVisibilityTest do
assert html =~ "Alice"
end
test "URL with only custom field keeps custom field visible (no invalid fallback)", %{
conn: conn,
custom_field: custom_field
} do
conn = conn_with_oidc_user(conn)
id = custom_field.id
{:ok, _view, html} = live(conn, "/members?fields=custom_field_#{id}")
# Selection must not be treated as invalid; custom field column stays visible
assert html =~ "M001" or html =~ custom_field.name
end
test "handles rapid toggling", %{conn: conn} do
conn = conn_with_oidc_user(conn)
{:ok, view, _html} = live(conn, "/members")