Repository navigation
Every repository gets adopted - #2903
Conversation
This reverts commit e294d32.
|
This is ready 🙏 |
niik
left a comment
There was a problem hiding this comment.
Looking good. A few questions and requests for documentation.
| return table.toCollection().each(repo => { | ||
| const key = `${repo.ownerID}+${repo.name}` | ||
| if (seenKeys.has(key)) { | ||
| table.delete(repo.id!) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| }) | ||
| } | ||
|
|
||
| private conditionalVersion( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| public owners: Dexie.Table<IDatabaseOwner, number> | ||
|
|
||
| public constructor(name: string) { | ||
| public constructor(name: string, requestedVersion?: number) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| import { getHTMLURL } from './api' | ||
| import { parseRemote } from './remote-parsing' | ||
|
|
||
| export interface IMatchedGitHubRepository { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| readonly htmlURL: string | null | ||
| readonly defaultBranch: string | null | ||
| readonly cloneURL: string | null | ||
| readonly parentID: number | null |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| const existingOwner = await this.db.owners | ||
| .where('[endpoint+login]') | ||
| .equals([endpoint, login]) | ||
| .limit(1) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| return `${this.owner.login}/${this.name}` | ||
| } | ||
|
|
||
| public get fork(): boolean { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| const login = gitHubRepository.owner.login.toLowerCase() | ||
| const owner = await this.putOwner(endpoint, login) | ||
|
|
||
| const existingRepo = await this.db.gitHubRepositories |
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.
`first` already include a `limit(1)`
|
🍯 |
| const login = gitHubRepository.owner.login.toLowerCase() | ||
| const owner = await this.putOwner(endpoint, login) | ||
|
|
||
| const existingRepo = await this.db.gitHubRepositories |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
In support of #2364.
Save GitHub repository parents, so that we can later use them to add the upstream remote.
This is a pretty big refactoring of the repositories store, along with a change to how we change (ha!) our models.
Since the Beginning of Time, our models have been immutable. When we wanted to change a property, we'd call a
with*method which would return a new copy of the model with the changed property. Then we'd pass the changed object to a store method which would update the database, etc.This was less than ideal for a few reasons. It meant changes took two steps: (1) change the object, (2) pass the changed object to the store. It also got confusing as to which was the source of truth: the model object we changed in memory, or the model object we get from the store? It was easy to accidentally change a model in memory without updating the store, or update the store but not used the updated model.
This PR changes it so that stores are entirely in charge of changes. Their change methods return the updated object. Models should, generally speaking, originate from stores.
/cc @desktop/core