mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-09-11 12:25:42 +03:00
Fix for incorrect GitHub error when working in non-GitHub repos
This commit is contained in:
parent
b623952fdd
commit
f67744eea1
@ -3,22 +3,6 @@ import { BehaviorSubject } from 'rxjs';
|
||||
import { expect, test, describe } from 'vitest';
|
||||
|
||||
const exampleRemoteUrls = [
|
||||
'ssh://user@host.xz:123/org/repo.git/',
|
||||
'ssh://user@host.xz/org/repo.git/',
|
||||
'ssh://host.xz:123/org/repo.git/',
|
||||
'ssh://host.xz:123/org/repo',
|
||||
'ssh://host.xz/org/repo.git/',
|
||||
'ssh://host.xz/org/repo.git',
|
||||
'ssh://host.xz/org/repo',
|
||||
'ssh://user@host.xz/org/repo.git/',
|
||||
'ssh://user@host.xz/org/repo.git',
|
||||
'ssh://user@host.xz/org/repo',
|
||||
'host.xz:org/repo.git/',
|
||||
'host.xz:org/repo.git',
|
||||
'host.xz:org/repo',
|
||||
'user@host.xz:org/repo.git/',
|
||||
'user@host.xz:org/repo.git',
|
||||
'user@host.xz:org/repo',
|
||||
'git@github.com:org/repo.git/',
|
||||
'git@github.com:org/repo.git',
|
||||
'git@github.com:org/repo',
|
||||
|
@ -70,7 +70,9 @@ export class GitHubService {
|
||||
combineLatest([accessToken$, remoteUrl$])
|
||||
.pipe(
|
||||
tap(([accessToken, remoteUrl]) => {
|
||||
if (!accessToken) {
|
||||
// We check the remote url since GitHub is currently enabled at the account
|
||||
// level rather than project level.
|
||||
if (!accessToken || !remoteUrl?.includes('github.com')) {
|
||||
return of();
|
||||
}
|
||||
this._octokit = new Octokit({
|
||||
@ -91,8 +93,8 @@ export class GitHubService {
|
||||
combineLatest([this.reload$, accessToken$, remoteUrl$])
|
||||
.pipe(
|
||||
tap(() => this.error$.next(undefined)),
|
||||
switchMap(([reload, _token, remoteUrl]) => {
|
||||
if (!this.isEnabled || !remoteUrl) return EMPTY;
|
||||
switchMap(([reload, _token, _remoteUrl]) => {
|
||||
if (!this._octokit || !this._owner) return EMPTY;
|
||||
const prs = this.fetchPrs(!!reload?.skipCache);
|
||||
this.fresh$.next();
|
||||
return prs;
|
||||
|
Loading…
Reference in New Issue
Block a user