Skip to content

Add external service states to the StatusMessages GraphQL endpoint

Created by: artemruts

Description

Redesigned notifications need to track two additional external service states to show the new UI:

  1. if the user has any external services
  2. if external services have any synced repositories
New UI states
  1. no code hosts

no codehosts

  1. no added repositories

no repositories

Currently, StatusMessages GraphQL endpoint doesn't provide that information, API console link.

To fetch additional states we have to rely on the ExternalServices GraphQL query, API console link.

https://github.com/sourcegraph/sourcegraph/blob/0121720d54220717bf529507cd20a2db555eaa88/client/web/src/nav/StatusMessagesNavItem.tsx#L202:L224

This is not ideal as we double the number of network calls and fetch extra data.

Acceptance Criteria

The StatusMessages GraphQL endpoint should be aware if the user has added any external services and if those services have repositories.

It could look something like this:

query StatusMessages {
  statusMessages {
    ... on ExternalServices {
      nodes {
        id
        kind
        displayName
        repoCount
      }
      totalCount
    }
  }
}

The endpoint returns the ExternalServices state for the currently authenticated user.