Skip to content

Commit

Permalink
updated at 2024-01-29T09:17:07-05:00
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfitz committed Jan 29, 2024
1 parent bcaba90 commit fc6d997
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core
Submodule core updated 58 files
+2 −2 app/client/billingMain.ts
+2 −0 app/client/components/DetailView.js
+53 −12 app/client/components/Forms/Columns.ts
+24 −4 app/client/components/Forms/Editor.ts
+80 −45 app/client/components/Forms/Field.ts
+188 −123 app/client/components/Forms/FormView.ts
+33 −8 app/client/components/Forms/Menu.ts
+54 −31 app/client/components/Forms/Model.ts
+7 −4 app/client/components/Forms/Section.ts
+4 −6 app/client/components/Forms/elements.ts
+103 −76 app/client/components/Forms/styles.ts
+14 −9 app/client/components/modals.ts
+2 −3 app/client/errorMain.ts
+16 −4 app/client/models/AppModel.ts
+0 −4 app/client/models/features.ts
+2 −1 app/client/ui/DocMenu.ts
+5 −9 app/client/ui/PageWidgetPicker.ts
+43 −17 app/client/ui/RightPanel.ts
+7 −1 app/client/ui/ShareMenu.ts
+1 −2 app/client/ui/ViewLayoutMenu.ts
+155 −9 app/client/ui/errorPages.ts
+12 −3 app/client/ui/setUpPage.ts
+2 −0 app/client/ui2018/IconList.ts
+1 −0 app/client/ui2018/cssVars.ts
+43 −12 app/client/ui2018/modals.ts
+2 −1 app/common/ApiError.ts
+67 −26 app/common/Forms.ts
+8 −6 app/common/Prefs.ts
+9 −1 app/common/Telemetry.ts
+1 −0 app/common/ThemePrefs-ti.ts
+1 −0 app/common/ThemePrefs.ts
+0 −40 app/common/UserAPI.ts
+27 −0 app/common/gristUrls.ts
+1 −0 app/common/themes/GristDark.ts
+1 −0 app/common/themes/GristLight.ts
+25 −3 app/server/lib/ActiveDoc.ts
+1 −1 app/server/lib/AppEndpoint.ts
+9 −1 app/server/lib/Client.ts
+23 −17 app/server/lib/DocApi.ts
+16 −2 app/server/lib/DocSession.ts
+1 −0 app/server/lib/FlexServer.ts
+5 −1 app/server/lib/NSandbox.ts
+19 −0 static/forms/README.md
+40 −0 static/forms/form-not-found.svg
+38 −0 static/forms/form-submitted.svg
+133 −28 static/forms/form.css
+46 −10 static/forms/form.html
+13 −1 static/forms/grist-form-submit.js
+1 −0 static/icons/icons.css
+65 −4 static/locales/en.client.json
+10 −0 static/ui-icons/UI/Headband.svg
+20 −0 test/client/models/gristUrlState.ts
+8 −5 test/gen-server/ApiServerAccess.ts
+392 −36 test/nbrowser/FormView.ts
+5 −11 test/nbrowser/RawData.ts
+15 −1 test/nbrowser/gristUtils.ts
+18 −0 test/server/Comm.ts
+17 −10 test/server/testUtils.ts
25 changes: 23 additions & 2 deletions ext/app/gen-server/lib/Notifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {encodeUrl, GristLoadConfig, IGristUrlState} from 'app/common/gristUrls';
import {isNonNullish} from 'app/common/gutil';
import {FullUser} from 'app/common/LoginSessionAPI';
import * as roles from 'app/common/roles';
import {StringUnion} from 'app/common/StringUnion';
import {BillingAccount} from 'app/gen-server/entity/BillingAccount';
import {Document} from 'app/gen-server/entity/Document';
import {Organization} from 'app/gen-server/entity/Organization';
Expand Down Expand Up @@ -275,7 +276,7 @@ export class Notifier extends UnsubscribeNotifier implements INotifier {
} else {
kind = 'document';
}
const url = await this._gristServer.getResourceUrl(resource);
const url = await this._makeInviteUrl(resource);
// Ok, we've gathered all the information we may need. Time to prepare a payload
// to send to sendgrid.
const personalizations: SendGridPersonalization[] = [];
Expand Down Expand Up @@ -786,8 +787,13 @@ export class Notifier extends UnsubscribeNotifier implements INotifier {
}
};
}
}

private async _makeInviteUrl(resource: Organization|Workspace|Document) {
const url = new URL(await this._gristServer.getResourceUrl(resource));
url.searchParams.set('utm_id', `invite-${getResourceName(resource)}`);
return url.href;
}
}

/**
* Describe the kind of resource in various ways to make handlebar templates
Expand All @@ -802,3 +808,18 @@ function describeKind(kind: SendGridInviteResourceKind) {
isTeamSite: kind === 'team site'
};
}

const ResourceName = StringUnion('org', 'ws', 'doc');
type ResourceName = typeof ResourceName.type;

function getResourceName(resource: Organization|Workspace|Document): ResourceName|null {
if (resource instanceof Organization) {
return 'org';
} else if (resource instanceof Workspace) {
return 'ws';
} else if (resource instanceof Document) {
return 'doc';
} else {
return null;
}
}

0 comments on commit fc6d997

Please sign in to comment.