mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) run survey for new users only when a survey doc is set
Summary: stop providing a default document id DOC_ID_NEW_USER_INFO for surveying, and don't show survey if a document id is not available. Test Plan: existing tests pass; grist-core checked Reviewers: georgegevoian Reviewed By: georgegevoian Subscribers: jarek Differential Revision: https://phab.getgrist.com/D3225
This commit is contained in:
parent
0c80547e0d
commit
7440485ebe
@ -5,10 +5,11 @@ import {IconName} from 'app/client/ui2018/IconList';
|
|||||||
import {ISaveModalOptions, saveModal} from 'app/client/ui2018/modals';
|
import {ISaveModalOptions, saveModal} from 'app/client/ui2018/modals';
|
||||||
import {BaseAPI} from 'app/common/BaseAPI';
|
import {BaseAPI} from 'app/common/BaseAPI';
|
||||||
import {UserPrefs} from 'app/common/Prefs';
|
import {UserPrefs} from 'app/common/Prefs';
|
||||||
|
import {getGristConfig} from 'app/common/urlUtils';
|
||||||
import {dom, input, Observable, styled, subscribeElem} from 'grainjs';
|
import {dom, input, Observable, styled, subscribeElem} from 'grainjs';
|
||||||
|
|
||||||
export function showWelcomeQuestions(userPrefsObs: Observable<UserPrefs>) {
|
export function showWelcomeQuestions(userPrefsObs: Observable<UserPrefs>) {
|
||||||
if (!userPrefsObs.get()?.showNewUserQuestions) {
|
if (!(getGristConfig().survey && userPrefsObs.get()?.showNewUserQuestions)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,6 +479,9 @@ export interface GristLoadConfig {
|
|||||||
|
|
||||||
// If custom widget list is available.
|
// If custom widget list is available.
|
||||||
enableWidgetRepository?: boolean;
|
enableWidgetRepository?: boolean;
|
||||||
|
|
||||||
|
// Whether there is somewhere for survey data to go.
|
||||||
|
survey?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Acceptable org subdomains are alphanumeric (hyphen also allowed) and of
|
// Acceptable org subdomains are alphanumeric (hyphen also allowed) and of
|
||||||
|
@ -76,8 +76,9 @@ const HEALTH_CHECK_LOG_SHOW_FIRST_N = 10;
|
|||||||
// And we show every Nth health check:
|
// And we show every Nth health check:
|
||||||
const HEALTH_CHECK_LOG_SHOW_EVERY_N = 100;
|
const HEALTH_CHECK_LOG_SHOW_EVERY_N = 100;
|
||||||
|
|
||||||
// DocID of Grist doc to collect the Welcome questionnaire responses.
|
// DocID of Grist doc to collect the Welcome questionnaire responses, such
|
||||||
const DOC_ID_NEW_USER_INFO = process.env.DOC_ID_NEW_USER_INFO || 'GristNewUserInfo';
|
// as "GristNewUserInfo".
|
||||||
|
const DOC_ID_NEW_USER_INFO = process.env.DOC_ID_NEW_USER_INFO;
|
||||||
|
|
||||||
export interface FlexServerOptions {
|
export interface FlexServerOptions {
|
||||||
dataDir?: string;
|
dataDir?: string;
|
||||||
@ -1593,6 +1594,8 @@ export class FlexServer implements GristServer {
|
|||||||
|
|
||||||
private async _recordNewUserInfo(row: object) {
|
private async _recordNewUserInfo(row: object) {
|
||||||
const urlId = DOC_ID_NEW_USER_INFO;
|
const urlId = DOC_ID_NEW_USER_INFO;
|
||||||
|
// If nowhere to record data, return immediately.
|
||||||
|
if (!urlId) { return; }
|
||||||
let body: string|undefined;
|
let body: string|undefined;
|
||||||
let permitKey: string|undefined;
|
let permitKey: string|undefined;
|
||||||
try {
|
try {
|
||||||
|
@ -46,6 +46,7 @@ export function makeGristConfig(homeUrl: string|null, extra: Partial<GristLoadCo
|
|||||||
maxUploadSizeAttachment: (Number(process.env.GRIST_MAX_UPLOAD_ATTACHMENT_MB) * 1024 * 1024) || undefined,
|
maxUploadSizeAttachment: (Number(process.env.GRIST_MAX_UPLOAD_ATTACHMENT_MB) * 1024 * 1024) || undefined,
|
||||||
timestampMs: Date.now(),
|
timestampMs: Date.now(),
|
||||||
enableWidgetRepository: Boolean(process.env.GRIST_WIDGET_LIST_URL),
|
enableWidgetRepository: Boolean(process.env.GRIST_WIDGET_LIST_URL),
|
||||||
|
survey: Boolean(process.env.DOC_ID_NEW_USER_INFO),
|
||||||
...extra,
|
...extra,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user