First cut of a simplified "intro" UI layout (#265)

* First cut of a simplified "intro" UI layout

* Linter

* Add guest role and intro-only access

* Fix guest role UI defaults (#940)

Use enum predicate to avoid missing role helper.

* Remove legacy user role mapping (#941)

Drop the unused user role references in role normalization
and SSO role mapping forms to avoid implying a role that
never existed.

Refs: #0

* Remove role normalization (#942)

Remove role normalization

Roles are now stored directly without legacy mappings.

* Revert role mapping logic

* Remove `normalize_role_settings`

* Remove unnecessary migration

* Make `member` the default

* Broken `.erb`

---------

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
This commit is contained in:
Juan José Mata
2026-02-09 11:09:25 +01:00
committed by GitHub
parent ba442d5f26
commit 705b5a8b26
33 changed files with 556 additions and 138 deletions

View File

@@ -9,6 +9,9 @@ class InvitationsControllerTest < ActionDispatch::IntegrationTest
test "should get new" do
get new_invitation_url
assert_response :success
assert_select "option[value=?]", "member"
assert_select "option[value=?]", "guest"
assert_select "option[value=?]", "admin"
end
test "should create invitation for member" do
@@ -89,6 +92,49 @@ class InvitationsControllerTest < ActionDispatch::IntegrationTest
assert_equal @admin, invitation.inviter
end
test "admin can create guest invitation" do
assert_difference("Invitation.count") do
post invitations_url, params: {
invitation: {
email: "intro-invite@example.com",
role: "guest"
}
}
end
invitation = Invitation.order(created_at: :desc).first
assert_equal "guest", invitation.role
assert_equal @admin.family, invitation.family
assert_equal @admin, invitation.inviter
end
test "inviting an existing user as guest applies intro defaults" do
existing_user = users(:empty)
existing_user.update!(
role: :member,
ui_layout: :dashboard,
show_sidebar: true,
show_ai_sidebar: true,
ai_enabled: false
)
assert_difference("Invitation.count") do
post invitations_url, params: {
invitation: {
email: existing_user.email,
role: "guest"
}
}
end
existing_user.reload
assert_equal "guest", existing_user.role
assert existing_user.ui_layout_intro?
assert_not existing_user.show_sidebar?
assert_not existing_user.show_ai_sidebar?
assert existing_user.ai_enabled?
end
test "should handle invalid invitation creation" do
assert_no_difference("Invitation.count") do
post invitations_url, params: {