mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Skip showing empty doc tours
Summary: Empty doc tours are now skipped. Before, an error was shown instead. Test Plan: Browser test. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D4204
This commit is contained in:
parent
ca8ac806db
commit
a5099fc598
@ -358,9 +358,9 @@ export class GristDoc extends DisposableWithEvents {
|
|||||||
urlState().state,
|
urlState().state,
|
||||||
isTourActiveObs(),
|
isTourActiveObs(),
|
||||||
fromKo(this.docModel.isTutorial),
|
fromKo(this.docModel.isTutorial),
|
||||||
(_use, state, hasActiveTour, isTutorial) => {
|
async (_use, state, hasActiveTour, isTutorial) => {
|
||||||
// Tours and tutorials can interfere with in-product tips and announcements.
|
// Tours and tutorials can interfere with in-product tips and announcements.
|
||||||
const hasPendingDocTour = state.docTour || this._shouldAutoStartDocTour();
|
const hasPendingDocTour = state.docTour || await this._shouldAutoStartDocTour();
|
||||||
const hasPendingWelcomeTour = state.welcomeTour || this._shouldAutoStartWelcomeTour();
|
const hasPendingWelcomeTour = state.welcomeTour || this._shouldAutoStartWelcomeTour();
|
||||||
const isPopupManagerDisabled = this.behavioralPromptsManager.isDisabled();
|
const isPopupManagerDisabled = this.behavioralPromptsManager.isDisabled();
|
||||||
if (
|
if (
|
||||||
@ -401,7 +401,7 @@ export class GristDoc extends DisposableWithEvents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const shouldStartTutorial = isTutorial;
|
const shouldStartTutorial = isTutorial;
|
||||||
const shouldStartDocTour = state.docTour || this._shouldAutoStartDocTour();
|
const shouldStartDocTour = state.docTour || await this._shouldAutoStartDocTour();
|
||||||
const shouldStartWelcomeTour = state.welcomeTour || this._shouldAutoStartWelcomeTour();
|
const shouldStartWelcomeTour = state.welcomeTour || this._shouldAutoStartWelcomeTour();
|
||||||
if (shouldStartTutorial || shouldStartDocTour || shouldStartWelcomeTour) {
|
if (shouldStartTutorial || shouldStartDocTour || shouldStartWelcomeTour) {
|
||||||
isStartingTourOrTutorial = true;
|
isStartingTourOrTutorial = true;
|
||||||
@ -1823,15 +1823,22 @@ export class GristDoc extends DisposableWithEvents {
|
|||||||
/**
|
/**
|
||||||
* Returns whether a doc tour should automatically be started.
|
* Returns whether a doc tour should automatically be started.
|
||||||
*
|
*
|
||||||
* Currently, tours are started if a GristDocTour table exists and the user hasn't
|
* Currently, tours are started if a non-empty GristDocTour table exists and the
|
||||||
* seen the tour before.
|
* user hasn't seen the tour before.
|
||||||
*/
|
*/
|
||||||
private _shouldAutoStartDocTour(): boolean {
|
private async _shouldAutoStartDocTour(): Promise<boolean> {
|
||||||
if (this._disableAutoStartingTours || this.docModel.isTutorial()) {
|
if (
|
||||||
|
this._disableAutoStartingTours ||
|
||||||
|
this.docModel.isTutorial() ||
|
||||||
|
!this.docModel.hasDocTour() ||
|
||||||
|
this._seenDocTours.get()?.includes(this.docId())
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.docModel.hasDocTour() && !this._seenDocTours.get()?.includes(this.docId());
|
const tableData = this.docData.getTable('GristDocTour')!;
|
||||||
|
await this.docData.fetchTable('GristDocTour');
|
||||||
|
return tableData.numRecords() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -218,4 +218,23 @@ describe("DuplicateDocument", function() {
|
|||||||
await driver.find(".test-bc-workspace").click();
|
await driver.find(".test-bc-workspace").click();
|
||||||
await gu.removeDoc(`DuplicateTest2 ${name} Copy`);
|
await gu.removeDoc(`DuplicateTest2 ${name} Copy`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should not auto-start tour if a document with a tour is copied as a template", async function() {
|
||||||
|
const session = await gu.session().teamSite.login();
|
||||||
|
await session.tempDoc(cleanup, 'doctour.grist');
|
||||||
|
await session.tempWorkspace(cleanup, 'Test Workspace');
|
||||||
|
assert.isTrue(await driver.findWait('.test-onboarding-popup', 1000).isPresent());
|
||||||
|
await driver.find('.test-onboarding-close').click();
|
||||||
|
await gu.waitForServer();
|
||||||
|
|
||||||
|
await driver.find('.test-tb-share').click();
|
||||||
|
await driver.find('.test-save-copy').click();
|
||||||
|
await driver.findWait('.test-modal-dialog', 1000);
|
||||||
|
await driver.find('.test-save-as-template').click();
|
||||||
|
await gu.completeCopy({destName: 'DuplicateTest3', destWorkspace: 'Test Workspace'});
|
||||||
|
|
||||||
|
// Give it a second, just to be sure the tour doesn't appear.
|
||||||
|
await driver.sleep(1000);
|
||||||
|
assert.isFalse(await driver.find('.test-onboarding-popup').isPresent());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user