Skip to content

[cloud][CLOUD-79] Hide organization code host connections and repository views based on a feature flag

Administrator requested to merge CLOUD-79-ui-milan into main

Created by: kopancek

Description

This PR changes the behavior in the UI in the following 2 ways:

  1. Instead of a user tag a feature flag org-code is used to determine, if we should show the organization code host connections and repository views
  2. If the user has a user tag CreateOrg, they are now able to create an organization even in cloud.

Related issue

https://sourcegraph.atlassian.net/browse/CLOUD-79

Video

The video below shows the behavior with the changes applied

Testing

Codehost connections and repository view

To test locally, you need to do the following procedure:

  1. start sourcegraph with EXTSVC_CONFIG_ALLOW_EDITS=true sg start dotcom
  2. Create a user, and modify the user tags in postgres:
UPDATE users SET tags = '{CreateOrg}' WHERE id = 1;
  1. Add an organization and yourself as a member of it
  2. You should NOT be able to see the organization codehost connections and repository views.
  3. Go to API console and add a feature flag called org-code, with a default value of false by running the following mutation:
mutation CreateFeatureFlag{
  createFeatureFlag(
    name: "org-code",
    value: false,
  ){
    __typename
  }
}
  1. The behavior should still be the same as before
  2. Create a feature flag override, with an override for organization you created and a value of true. The value for namespace is base64 encoded, e.g. 'Org: 1' if ID of your organization is 1:
mutation CreateFeatureFlagOverride{
  createFeatureFlagOverride(
    namespace: "T3JnOjE=", 
    flagName: "org-code",
    value: true,
  ){
    __typename
  }
}
  1. The codehost connection and repository views should be visible now

Creating new organization

This is now hidden behind a user tag on cloud. If the user does not have the user tag, the button New organization in the settings menu will be hidden.

  1. Go to settings, you should see About Organizations link in the settings sidebar
  2. Run the following query on Postgres and use the user id of your user:
UPDATE users SET tags = '{CreateOrg}' WHERE id = 42;
  1. Refresh the browser window. You should now see New organization button in the settings sidebar

Merge request reports

Loading