Repository navigation
Multi user - #41
Multi user#41garethedwards-tass wants to merge 15 commits into
Conversation
|
I'll be watching this PR with great interest! Feel free to mark the PR as ready (non-draft) once it's ready for review. |
|
I'm passing "login" around a bit in an attempt to use it to find the appropriate account, but I've recently realized I could probably use account@ prefixes on the github URL's quite effectively, a lot of the git CLI stuff is working, but github API stuff is not |
|
@ghedwards I think passing the username around is probably the right call, since the account@ prefix might not be reliable, especially when cloning with SSH instead of HTTP. |
| const multipleLoginAccounts = enableMultipleLoginAccounts() | ||
|
|
||
| try { | ||
| const key = getKeyForAccount(account) | ||
| await this.secureStore.setItem(key, account.login, account.token) | ||
| } catch (e) { | ||
| log.error(`Error adding account '${account.login}'`, e) | ||
|
|
||
| if (__DARWIN__ && isKeyChainError(e)) { | ||
| this.emitError( | ||
| new Error( | ||
| `GitHub Desktop was unable to store the account token in the keychain. Please check you have unlocked access to the 'login' keychain.` | ||
| ) | ||
| ) | ||
| } else { | ||
| this.emitError(e) | ||
| } |
There was a problem hiding this comment.
Wouldn't it be better to just call storeAccountKey?
|
Basics appear to be working ( I was reasonably far off earlier ), probably not ready for end users, but might be ready to have a look, and maybe even run through some workflows to see what works and what doesn't. I suspect backward compatibility with stores and manual / URL cloning might not work very well at the moment.. @pol-rivero |
|
I've put the "login" in text () next to the grouping by "owner", @pol-rivero what would you do with repositories that don't currently have a specific user assigned, force the selection of an account on import, but then that doesn't fix existing repo's, maybe in this case just expect a user to delete and re-import ?
|
|
I think the best way to handle imported repositories would be:
Additionally, in the repository settings (probably in the Integrations tab) there should be an option to change the linked account. |
|
"as usual" would imply using the first account that matches the endpoint ( ie. github.com ) ? not link an account, not sure I follow, whats the use in doing that ? the current system would just find the first account ? |
|
Sorry, I was a bit vague there. Edit: Regarding this:
My point is that we should not use the first account. If the account to use is ambiguous (that is, there are 2 or more accounts, and none of them is the owner), we should show an account selector with all the candidates (accounts with the same endpoint as the repo) and let the user decide. |
|
Just got to a point where I believe 'login' is kept up to date across the repository and the githubRepository, it generally can be undefined or empty string so it should cater for what you're talking about. It could just get a bit confusing as people add accounts... anyway, in a reasonably good place, but I go on holiday in a few days so I was hoping to get the code somewhere others can maintain it, maybe create a new branch and I can send the PR there ? and then maybe make me a maintainer ? |

Multi user support