Skip to content

Commit

Permalink
Hide repo aliases behind a feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiou87 committed Apr 14, 2021
1 parent 62b3da8 commit b8eb98d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/src/lib/feature-flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,8 @@ export function enableUpdateFromRosettaToARM64(): boolean {
export function enableSaveDialogOnCloneRepository(): boolean {
return enableBetaFeatures()
}

/** Should we allow setting repository aliases? */
export function enableRepositoryAliases(): boolean {
return enableBetaFeatures()
}
3 changes: 2 additions & 1 deletion app/src/lib/stores/repositories-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { WorkflowPreferences } from '../../models/workflow-preferences'
import { clearTagsToPush } from './helpers/tags-to-push-storage'
import { IMatchedGitHubRepository } from '../repository-matching'
import { shallowEquals } from '../equality'
import { enableRepositoryAliases } from '../feature-flag'

/** The store for local repositories. */
export class RepositoriesStore extends TypedBaseStore<
Expand Down Expand Up @@ -132,7 +133,7 @@ export class RepositoriesStore extends TypedBaseStore<
? await this.findGitHubRepositoryByID(repo.gitHubRepositoryID)
: await Promise.resolve(null), // Dexie gets confused if we return null
repo.missing,
repo.alias,
enableRepositoryAliases() ? repo.alias : null,
repo.workflowPreferences,
repo.isTutorialRepository
)
Expand Down
3 changes: 2 additions & 1 deletion app/src/ui/repositories-list/repository-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
RevealInFileManagerLabel,
DefaultEditorLabel,
} from '../lib/context-menu'
import { enableRepositoryAliases } from '../../lib/feature-flag'

interface IRepositoryListItemProps {
readonly repository: Repositoryish
Expand Down Expand Up @@ -162,7 +163,7 @@ export class RepositoryListItem extends React.Component<
private buildAliasMenuItems(): ReadonlyArray<IMenuItem> {
const repository = this.props.repository

if (!(repository instanceof Repository)) {
if (!(repository instanceof Repository) || !enableRepositoryAliases()) {
return []
}

Expand Down

0 comments on commit b8eb98d

Please sign in to comment.