mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Avoid flagging support user as collaborator
Summary: When initially added in the User Manager, the support user (e.g. support@getgrist.com) was misleadingly being annotated as a free collaborator. This fixes the annotation to be "Grist support" instead. Test Plan: Browser test. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D3730
This commit is contained in:
@@ -28,14 +28,23 @@ export interface ShareAnnotations {
|
||||
users: Map<string, ShareAnnotation>; // Annotations keyed by normalized user email.
|
||||
}
|
||||
|
||||
export interface ShareAnnotatorOptions {
|
||||
supportEmail?: string; // Known email address of the support user (e.g. support@getgrist.com).
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for annotating users mentioned in a proposed change of shares, given the
|
||||
* current shares in place.
|
||||
*/
|
||||
export class ShareAnnotator {
|
||||
private _features = this._product?.features ?? {};
|
||||
private _supportEmail = this._options.supportEmail;
|
||||
|
||||
constructor(private _product: Product|null, private _state: PermissionData) {
|
||||
constructor(
|
||||
private _product: Product|null,
|
||||
private _state: PermissionData,
|
||||
private _options: ShareAnnotatorOptions = {}
|
||||
) {
|
||||
}
|
||||
|
||||
public updateState(state: PermissionData) {
|
||||
@@ -84,7 +93,10 @@ export class ShareAnnotator {
|
||||
.map(([k, ]) => normalizeEmail(k)));
|
||||
for (const email of tweaks) {
|
||||
const annotation = annotations.users.get(email) || makeAnnotation({
|
||||
email, isMember: false, access: '<set>',
|
||||
email,
|
||||
isMember: false,
|
||||
isSupport: Boolean(email.trim() !== '' && email === this._supportEmail),
|
||||
access: '<set>',
|
||||
});
|
||||
annotations.users.set(email, annotation);
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ export interface GristLoadConfig {
|
||||
|
||||
// In single-org mode, this is the single well-known org. Suppress any org selection UI.
|
||||
singleOrg?: string;
|
||||
|
||||
|
||||
// Url for support for the browser client to use.
|
||||
helpCenterUrl?: string;
|
||||
|
||||
@@ -578,6 +578,9 @@ export interface GristLoadConfig {
|
||||
|
||||
// TODO: remove when comments will be released.
|
||||
featureComments?: boolean;
|
||||
|
||||
// Email address of the support user.
|
||||
supportEmail?: string;
|
||||
}
|
||||
|
||||
export const HideableUiElements = StringUnion("helpCenter", "billing", "templates", "multiSite", "multiAccounts");
|
||||
|
||||
Reference in New Issue
Block a user