Show fork settings dialog after forking a repository

This commit is contained in:
Rafael Oleza 2020-05-26 15:34:14 +02:00
parent f5bb6bcd96
commit 30fe24ccf8
2 changed files with 15 additions and 4 deletions

View file

@ -2081,8 +2081,8 @@ export class Dispatcher {
public async convertRepositoryToFork(
repository: RepositoryWithGitHubRepository,
fork: IAPIRepository
) {
await this.appStore._convertRepositoryToFork(repository, fork)
): Promise<Repository> {
return this.appStore._convertRepositoryToFork(repository, fork)
}
/**

View file

@ -6,12 +6,16 @@ import {
DefaultDialogFooter,
} from '../dialog'
import { Dispatcher } from '../dispatcher'
import { RepositoryWithGitHubRepository } from '../../models/repository'
import {
RepositoryWithGitHubRepository,
isRepositoryWithForkedGitHubRepository,
} from '../../models/repository'
import { OkCancelButtonGroup } from '../dialog/ok-cancel-button-group'
import { sendNonFatalException } from '../../lib/helpers/non-fatal-exception'
import { Account } from '../../models/account'
import { API } from '../../lib/api'
import { LinkButton } from '../lib/link-button'
import { PopupType } from '../../models/popup'
interface ICreateForkDialogProps {
readonly dispatcher: Dispatcher
@ -49,12 +53,19 @@ export class CreateForkDialog extends React.Component<
gitHubRepository.name
)
this.props.dispatcher.recordForkCreated()
await this.props.dispatcher.convertRepositoryToFork(
const updatedRepository = await this.props.dispatcher.convertRepositoryToFork(
this.props.repository,
fork
)
this.setState({ loading: false })
this.props.onDismissed()
if (isRepositoryWithForkedGitHubRepository(updatedRepository)) {
this.props.dispatcher.showPopup({
type: PopupType.ChooseForkSettings,
repository: updatedRepository,
})
}
} catch (e) {
log.error(`Fork creation through API failed (${e})`)
sendNonFatalException('forkCreation', e)