Skip to content

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

Screenshots or screen recordings

Before After
Screenshot_2025-05-07_at_4.54.25_PM Screenshot_2025-05-07_at_4.50.17_PM

How to set up and validate locally

  1. 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')
  2. Go to a commit or merge request: https://gdk.test:3443/gitlab-org/gitlab-test/-/merge_requests/1/diffs
  3. Mention the new alias in a comment: Hey @support-bot-alias
  4. Ensure the note links to the original user, but displays the alias text
Longer, more realistic setup
  1. Enable the feature flag for organizations UI
  2. Create a new Organization from the admin menu: https://gdk.test:3443/admin/organizations
  3. Within the Organizations admin interface, create a new top-level group for the Organization: https://gdk.test:3443/-/organizations/snake-oil/groups_and_projects
  4. Ensure the new group has an Ultimate plan
  5. On the Rails console, enable the feature flag: Feature.enable(:organization_users_internal)
  6. On the Rails console, create an Admin bot for the organization: Users::Internal.for_organization(Organizations::Organization.last).admin_bot
  7. Enable SAML SSO for the new group
  8. Set up Okta Dev SAML or local SAML for the new group
  9. In an incognito window, sign in via SAML to create a new user within the new Organization
  10. As the new user, create a new project in the group
  11. Create a new issue on the project
  12. Mention the admin bot in the issue description or comments: @GitLab-Admin-Bot
  13. 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

Merge request reports

Loading