Skip to content

Expose user emails via GraphQL

What does this MR do and why?

Related to Make committer email be configurable for groups... (#26710)

In order to build a Vue app which allows us to configure default commit e-mails per namespace, we need to expose:

  • available e-mails
  • currently configured commit emails per namespace
  • default commit e-mail

This MR adds them to GraphQL.

Screenshots or screen recordings

image

How to set up and validate locally

The only way to create namespace commit emails is currently via the rails console. To make life easier- and "practice what I preach" #385333 - I have created seed data. You can insert the seed data by running:

FILTER=emails rake db:seed_fu

Then run a GraphQL query something like:

    query {
      user(username: "root") {
        id
        emails {
          nodes {
            id
            confirmedAt
            email
          }
        }
        namespaceCommitEmails {
          nodes {
            id
            namespace {
              id
              fullPath
            }
            email {
              id
              email
            }
          }
        }
        commitEmail
        publicEmail
      }
   }

When logged in as root or an administrator, you should see all details, but if you impersonate a "non-administrator" you should see that the e-mail addresses are not returned.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Lee Tickett

Merge request reports

Loading