fix: wiki still try to load view of bad folder workspace

This commit is contained in:
林一二 2021-06-09 00:30:57 +08:00
parent 25f3920c9f
commit 3ec30fa98d

View file

@ -15,6 +15,7 @@ import { IPreferenceService } from '@services/preferences/interface';
import { logger } from '@services/libs/log';
import { IAuthenticationService } from '@services/auth/interface';
import { IGitService } from '@services/git/interface';
import { IWikiService } from '@services/wiki/interface';
import { IWorkspaceViewService } from './interface';
import { lazyInject } from '@services/container';
import { SupportedStorageServices } from '@services/types';
@ -24,6 +25,7 @@ export class WorkspaceView implements IWorkspaceViewService {
@lazyInject(serviceIdentifier.Authentication) private readonly authService!: IAuthenticationService;
@lazyInject(serviceIdentifier.View) private readonly viewService!: IViewService;
@lazyInject(serviceIdentifier.Git) private readonly gitService!: IGitService;
@lazyInject(serviceIdentifier.Wiki) private readonly wikiService!: IWikiService;
@lazyInject(serviceIdentifier.Workspace) private readonly workspaceService!: IWorkspaceService;
@lazyInject(serviceIdentifier.Window) private readonly windowService!: IWindowService;
@lazyInject(serviceIdentifier.Preference) private readonly preferenceService!: IPreferenceService;
@ -53,6 +55,9 @@ export class WorkspaceView implements IWorkspaceViewService {
if (!workspace.isSubWiki) {
await this.viewService.addView(mainWindow, workspace);
}
if ((await this.wikiService.checkWikiExist(workspace.wikiFolderLocation, true)) === true) {
continue;
}
const userInfo = await this.authService.getStorageServiceUserInfo(workspace.storageService);
const { wikiFolderLocation, gitUrl: githubRepoUrl, storageService } = workspace;
// wait for main wiki's watch-fs plugin to be fully initialized