[cloud][CLOUD-79] Hide organization code host connections and repository views based on a feature flag
Created by: kopancek
Description
This PR changes the behavior in the UI in the following 2 ways:
- 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 - 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:
- start sourcegraph with
EXTSVC_CONFIG_ALLOW_EDITS=true sg start dotcom
- Create a user, and modify the user tags in postgres:
UPDATE users SET tags = '{CreateOrg}' WHERE id = 1;
- Add an organization and yourself as a member of it
- You should NOT be able to see the organization codehost connections and repository views.
- Go to API console and add a feature flag called
org-code
, with a default value offalse
by running the following mutation:
mutation CreateFeatureFlag{
createFeatureFlag(
name: "org-code",
value: false,
){
__typename
}
}
- The behavior should still be the same as before
- 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
}
}
- 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.
- Go to settings, you should see
About Organizations
link in the settings sidebar - Run the following query on Postgres and use the user id of your user:
UPDATE users SET tags = '{CreateOrg}' WHERE id = 42;
- Refresh the browser window. You should now see
New organization
button in the settings sidebar