Repository navigation
Let my people clone - #1213
Let my people clone#1213
Conversation
shiftkey
left a comment
There was a problem hiding this comment.
Code looks good - one suggestion for cleanup.
This doesn't address a public owner/repo alias when unauthenticated - not sure if that's worth tackling here as it's getting further into edge cases.
|
|
||
| if (identifier) { | ||
| const api = new API(account) | ||
| const api = new API(account || Account.anonymous()) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Oh don't worry, it was still WIP 😅 |
|
But now it's ready 🎭 |
| const path = this.state.path | ||
| const cloneDetails = await this.resolveCloneDetails() | ||
| if (!cloneDetails) { | ||
| const error = new Error(`We couldn't find that repository. Make sure it's spelled right and you're logged in.`) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } else { | ||
| return false | ||
| } | ||
| } catch (e) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| // First try parsing it as a full URL. If that doesn't work, try parsing it | ||
| // as an owner/name shortcut. And if that fails then throw our hands in the | ||
| // air because we truly don't care. | ||
| // We have a couple strategies to try to figure out what account we should |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @param accounts - the list of active GitHub and GitHub Enterprise accounts | ||
| */ | ||
| export async function findAccountForRemote(url: string, accounts: ReadonlyArray<Account>): Promise<Account> { | ||
| export async function findAccountForRemote(url: string, accounts: ReadonlyArray<Account>): Promise<Account | null> { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| const sortedAccounts = Array.from(accounts).sort((a1, a2) => { | ||
| if (a1.endpoint === getDotComAPIEndpoint()) { | ||
| return -1 | ||
| if (a1.token.length) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
shiftkey
left a comment
There was a problem hiding this comment.
So close, just noticed a couple of destructuring places that tidy things up a bit.
|
|
||
| if (dotComAccount) { | ||
| return dotComAccount | ||
| if (account) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| const parsedOwnerAndName = parseOwnerAndName(url) | ||
| const parsedOwnerAndName = parseOwnerAndName(urlOrRepositoryAlias) | ||
| if (parsedOwnerAndName) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
🏜 |


Fixes #1163