mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Redirect less often in welcomeNewUser
Summary: Instead of always redirecting new users to the home page or the (teams) welcome page, only redirect when the user signed in for the first time on a personal site, has access to other sites, and isn't already being redirected to a specific page on their personal site. Also tweaks how invalid Choice column values are displayed to match Choice List columns, and fixes a small CSS issue with select by in the page widget picker when there are options with long labels. Test Plan: Browser tests. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3461
This commit is contained in:
@@ -732,7 +732,7 @@ export class FlexServer implements GristServer {
|
||||
const user = getUser(req);
|
||||
if (user && user.isFirstTimeUser) {
|
||||
log.debug(`welcoming user: ${user.name}`);
|
||||
// Reset isFirstTimeUser flag.
|
||||
// Reset isFirstTimeUser flag.
|
||||
await this._dbManager.updateUser(user.id, {isFirstTimeUser: false});
|
||||
|
||||
// This is a good time to set some other flags, for showing a popup with welcome question(s)
|
||||
@@ -744,19 +744,18 @@ export class FlexServer implements GristServer {
|
||||
recordSignUpEvent: true,
|
||||
}});
|
||||
|
||||
if (process.env.GRIST_SINGLE_ORG) {
|
||||
// Merged org is not meaningful in this case.
|
||||
return res.redirect(this.getHomeUrl(req));
|
||||
const domain = mreq.org ?? null;
|
||||
if (!process.env.GRIST_SINGLE_ORG && this._dbManager.isMergedOrg(domain)) {
|
||||
// We're logging in for the first time on the merged org; if the user has
|
||||
// access to other team sites, forward the user to a page that lists all
|
||||
// the teams they have access to.
|
||||
const result = await this._dbManager.getMergedOrgs(user.id, user.id, domain);
|
||||
const orgs = this._dbManager.unwrapQueryResult(result);
|
||||
if (orgs.length > 1 && mreq.path === '/') {
|
||||
// Only forward if the request is for the home page.
|
||||
return res.redirect(this.getMergedOrgUrl(mreq, '/welcome/teams'));
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect to teams page if users has access to more than one org. Otherwise, redirect to
|
||||
// personal org.
|
||||
const domain = mreq.org;
|
||||
const result = await this._dbManager.getMergedOrgs(user.id, user.id, domain || null);
|
||||
const orgs = (result.status === 200) ? result.data : null;
|
||||
const redirectPath = orgs && orgs.length > 1 ? '/welcome/teams' : '/';
|
||||
const redirectUrl = this.getMergedOrgUrl(mreq, redirectPath);
|
||||
return res.redirect(redirectUrl);
|
||||
}
|
||||
if (mreq.org && mreq.org.startsWith('o-')) {
|
||||
// We are on a team site without a custom subdomain.
|
||||
|
||||
Reference in New Issue
Block a user