User OrganizationUserDetail in mentions, autocomplete, participants
What does this MR do and why?
User OrganizationUserDetail in mentions, autocomplete, participants
Part 3 of our effort to allow internal bot users to be scoped per-organization. This allows users with an Organizations::OrganizationUserDetail record to be @ mentioned within projects or groups in an organization by the alias rather than by their username. Noteables mentioning these users will link to the orignal username, not the alias, but will display with the alias.
References
- Original MR this is split out from: !186023 (closed)
- Feature issue: #442780 (closed)
- Part 1: Allow specifying an Organization for internal users: !186690 (merged)
- Part 2: Add OrganizationUserDetail table: !191575 (merged)
Screenshots or screen recordings
Before | After |
---|---|
![]() |
![]() |
How to set up and validate locally
- On the Rails console, enable the feature and create an alias for an internal bot user:
Feature.enable(:organization_users_internal, Organizations::Organization.first) org = Organizations::Organization.first user = Users::Internal.support_bot org_alias = Organizations::OrganizationUserDetail.create(organization: org, user: user, username: 'support-bot-alias', display_name: 'Support Bot Alias')
- Go to a commit or merge request: https://gdk.test:3443/gitlab-org/gitlab-test/-/merge_requests/1/diffs
- Mention the new alias in a comment:
Hey @support-bot-alias
- Ensure the note links to the original user, but displays the alias text
Longer, more realistic setup
- Enable the feature flag for organizations UI
- Create a new Organization from the admin menu: https://gdk.test:3443/admin/organizations
- Within the Organizations admin interface, create a new top-level group for the Organization: https://gdk.test:3443/-/organizations/snake-oil/groups_and_projects
- Ensure the new group has an Ultimate plan
- On the Rails console, enable the feature flag:
Feature.enable(:organization_users_internal)
- On the Rails console, create an Admin bot for the organization:
Users::Internal.for_organization(Organizations::Organization.last).admin_bot
- Enable SAML SSO for the new group
- Set up Okta Dev SAML or local SAML for the new group
- In an incognito window, sign in via SAML to create a new user within the new Organization
- As the new user, create a new project in the group
- Create a new issue on the project
- Mention the admin bot in the issue description or comments:
@GitLab-Admin-Bot
- Ensure the link appears with the username alias
@GitLab-Admin-Bot
, but links to the per-organization user,@GitLab-Admin-Bot_snake-oil
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #442780 (closed)
Edited by Andrew Evans