feat: support multiple accounts on the same GitLab instance
This MR changes the AccountService
to store Account
s instead of just a pair of instanceUrl
and token
. Thanks to this, users can create multiple accounts for the same instance (e.g. work and personal accounts).
I put a lot of effort into creating multiple atomic commits so even though this MR has +331-81
changes, all the commits are relatively self-contained and small. This should make them easier to review and I recommend reviewing this MR commit-by-commit.
The three main parts of this MR are:
- Change the internal storage in
AccountService
fromtokenMap
toaccountMap
. - Implement migration for old tokens (we'll migrate them to accounts during extension startup)
- Migrate selected projects settings. Till now, we used only
instanceUrl
as the account ID. This was enough because there could not be more than one token per instance. Now that we can have multiple accounts, we need to use the${instanceUrl}|${userId}
as an account identifier.
Related to #298 (closed)
Edited by Tomas Vik