Skip to content

Display badge if a user is a GitLab employee

What does this MR do?

See #207118 (closed)

backend counterpart issue and MR: #209327 (closed) !26836 (merged)

For users with a @gitlab.com email address (See !26836 (merged) for how this is being determined):

  • Adds a GitLab employee badge to comments on issues and merge requests
  • On edit profile page it changes "Organization" field to readonly and pre-populates with "GitLab"

Local Testing

  1. Enable :gitlab_employee_badge feature flag.
    • bin/rails console
    • Feature.enable(:gitlab_employee_badge)
  2. In lib/gitlab.rb change self.com? to return true
  3. Create a user with a @gitlab.com email address
  4. Navigate to /profile, Organization field should be readonly
  5. Create a comment on a Issue/MR/Epic. A badge will appear next to your username. Note The backend endpoint is currently not working on the master branch. There was a mixup and the /discussions endpoint was updated instead of /discussions.json. You can temporarily merge in the fix-gitlab-employee-attribute branch to test this feature.

Feature Flag

This MR is behind the :gitlab_employee_badge feature flag. Flag is used in app/views/profiles/show.html.haml. It is not needed in app/assets/javascripts/notes/components/note_header.vue as the badge is not shown if author.is_gitlab_employee is undefined (which it will be when the feature flag is turned off).

Screenshots

Expand
Page Before After
Edit Profile gdk.localhost_3443_profile__2_ gdk.localhost_3443_profile__1_
Issue Comment gdk.localhost_3443_gitlab-org_gitlab-shell_-_issues_4 gdk.localhost_3443_gitlab-org_gitlab-shell_-issues_4__1
Issue Comment Mobile gdk.localhost_3443_gitlab-org_gitlab-shell_-issues_4_iPhone_6_7_8 gdk.localhost_3443_gitlab-org_gitlab-shell_-issues_4_iPhone_6_7_8___1
MR Comment gdk.localhost_3443_gitlab-org_gitlab-shell_-merge_requests_6__1 gdk.localhost_3443_gitlab-org_gitlab-shell_-merge_requests_6__2
MR Comment Mobile gdk.localhost_3443_gitlab-org_gitlab-shell_-merge_requests_6_iPhone_6_7_8 gdk.localhost_3443_gitlab-org_gitlab-shell_-merge_requests_6_iPhone_6_7_8___1

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Peter Hegman

Merge request reports