Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

chore(core): doc role telemetry (#10822)

forehalo7100d87efeb7
diff --git a/packages/frontend/core/src/modules/share-menu/view/share-menu/general-access/members-permission.tsx b/packages/frontend/core/src/modules/share-menu/view/share-menu/general-access/members-permission.tsx
index b313e8a7d9..f2e3b2d1cd 100644
--- a/packages/frontend/core/src/modules/share-menu/view/share-menu/general-access/members-permission.tsx
+++ b/packages/frontend/core/src/modules/share-menu/view/share-menu/general-access/members-permission.tsx
@@ -58,7 +58,7 @@ export const MembersPermission = ({
async (docRole: DocRole) => {
try {
track.$.sharePanel.$.modifyDocDefaultRole({
- control: docRole,
+ role: docRole,
});
await docGrantedUsersService.updateDocDefaultRole(docRole);
shareInfoService.shareInfo.revalidate();
diff --git a/packages/frontend/core/src/modules/share-menu/view/share-menu/member-management/member-item.tsx b/packages/frontend/core/src/modules/share-menu/view/share-menu/member-management/member-item.tsx
index 273a34840f..1ce900be1f 100644
--- a/packages/frontend/core/src/modules/share-menu/view/share-menu/member-management/member-item.tsx
+++ b/packages/frontend/core/src/modules/share-menu/view/share-menu/member-management/member-item.tsx
@@ -148,7 +148,7 @@ const Options = ({
const updateUserRole = useCallback(
async (userId: string, role: DocRole) => {
- track.$.sharePanel.$.modifyUserDocRole({ control: role });
+ track.$.sharePanel.$.modifyUserDocRole({ control: 'Update', role });
try {
const res = await docGrantedUsersService.updateUserRole(userId, role);
if (res) {
diff --git a/packages/frontend/graphql/src/schema.ts b/packages/frontend/graphql/src/schema.ts
index 3d6870d972..189817ec72 100644
--- a/packages/frontend/graphql/src/schema.ts
+++ b/packages/frontend/graphql/src/schema.ts
@@ -379,6 +379,7 @@ export enum DocRole {
Editor = 'Editor',
External = 'External',
Manager = 'Manager',
+ None = 'None',
Owner = 'Owner',
Reader = 'Reader',
}
@@ -510,6 +511,7 @@ export enum ErrorNames {
FAILED_TO_UPSERT_SNAPSHOT = 'FAILED_TO_UPSERT_SNAPSHOT',
GRAPHQL_BAD_REQUEST = 'GRAPHQL_BAD_REQUEST',
INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR',
+ INVALID_AUTH_STATE = 'INVALID_AUTH_STATE',
INVALID_CHECKOUT_PARAMETERS = 'INVALID_CHECKOUT_PARAMETERS',
INVALID_EMAIL = 'INVALID_EMAIL',
INVALID_EMAIL_TOKEN = 'INVALID_EMAIL_TOKEN',
@@ -636,6 +638,10 @@ export interface GraphqlBadRequestDataType {
message: Scalars['String']['output'];
}
+export interface ImportUsersInput {
+ users: Array<CreateUserInput>;
+}
+
export interface InvalidEmailDataType {
__typename?: 'InvalidEmailDataType';
email: Scalars['String']['output'];
@@ -750,6 +756,8 @@ export interface InviteUserType {
* @deprecated useless
*/
createdAt: Maybe<Scalars['DateTime']['output']>;
+ /** User is disabled */
+ disabled: Maybe<Scalars['Boolean']['output']>;
/** User email */
email: Maybe<Scalars['String']['output']>;
/** User email verified */
@@ -891,6 +899,8 @@ export interface Mutation {
addContextDoc: Array<CopilotContextListItem>;
addWorkspaceFeature: Scalars['Boolean']['output'];
approveMember: Scalars['Boolean']['output'];
+ /** Ban an user */
+ banUser: UserType;
cancelSubscription: SubscriptionType;
changeEmail: UserType;
changePassword: Scalars['Boolean']['output'];
@@ -922,11 +932,15 @@ export interface Mutation {
/** Delete a user account */
deleteUser: DeleteAccount;
deleteWorkspace: Scalars['Boolean']['output'];
+ /** Reenable an banned user */
+ enableUser: UserType;
/** Create a chat session */
forkCopilotSession: Scalars['String']['output'];
generateLicenseKey: Scalars['String']['output'];
grantDocUserRoles: Scalars['Boolean']['output'];
grantMember: Scalars['Boolean']['output'];
+ /** import users */
+ importUsers: Array<UserImportResultType>;
invite: Scalars['String']['output'];
inviteBatch: Array<InviteResult>;
leaveWorkspace: Scalars['Boolean']['output'];
@@ -969,7 +983,7 @@ export interface Mutation {
/** update multiple server runtime configurable settings */
updateRuntimeConfigs: Array<ServerRuntimeConfigType>;
updateSubscriptionRecurring: SubscriptionType;
- /** Update a user */
+ /** Update an user */
updateUser: UserType;
/** update user enabled feature */
updateUserFeatures: Array<FeatureType>;
@@ -1005,6 +1019,10 @@ export interface MutationApproveMemberArgs {
workspaceId: Scalars['String']['input'];
}
+export interface MutationBanUserArgs {
+ id: Scalars['String']['input'];
+}
+
export interface MutationCancelSubscriptionArgs {
idempotencyKey?: InputMaybe<Scalars['String']['input']>;
plan?: InputMaybe<SubscriptionPlan>;
@@ -1088,6 +1106,10 @@ export interface MutationDeleteWorkspaceArgs {
id: Scalars['String']['input'];
}
+export interface MutationEnableUserArgs {
+ id: Scalars['String']['input'];
+}
+
export interface MutationForkCopilotSessionArgs {
options: ForkChatSessionInput;
}
@@ -1106,6 +1128,10 @@ export interface MutationGrantMemberArgs {
workspaceId: Scalars['String']['input'];
}
+export interface MutationImportUsersArgs {
+ input: ImportUsersInput;
+}
+
export interface MutationInviteArgs {
email: Scalars['String']['input'];
permission?: InputMaybe<Permission>;
@@ -1517,6 +1543,14 @@ export interface QueryTooLongDataType {
max: Scalars['Int']['output'];
}
+export interface ReleaseVersionType {
+ __typename?: 'ReleaseVersionType';
+ changelog: Scalars['String']['output'];
+ publishedAt: Scalars['DateTime']['output'];
+ url: Scalars['String']['output'];
+ version: Scalars['String']['output'];
+}
+
export interface RemoveAvatar {
__typename?: 'RemoveAvatar';
success: Scalars['Boolean']['output'];
@@ -1553,6 +1587,8 @@ export interface SameSubscriptionRecurringDataType {
export interface ServerConfigType {
__typename?: 'ServerConfigType';
+ /** fetch latest available upgradable release of server */
+ availableUpgrade: ReleaseVersionType;
/** Features for user that can be configured */
availableUserFeatures: Array<FeatureType>;
/** server base url */
@@ -1772,6 +1808,14 @@ export interface UpdateWorkspaceInput {
public?: InputMaybe<Scalars['Boolean']['input']>;
}
+export interface UserImportFailedType {
+ __typename?: 'UserImportFailedType';
+ email: Scalars['String']['output'];
+ error: Scalars['String']['output'];
+}
+
+export type UserImportResultType = UserImportFailedType | UserType;
+
export type UserOrLimitedUser = LimitedUserType | UserType;
export interface UserQuotaHumanReadableType {
@@ -1813,6 +1857,8 @@ export interface UserType {
* @deprecated useless
*/
createdAt: Maybe<Scalars['DateTime']['output']>;
+ /** User is disabled */
+ disabled: Scalars['Boolean']['output'];
/** User email */
email: Scalars['String']['output'];
/** User email verified */
diff --git a/packages/frontend/track/src/events.ts b/packages/frontend/track/src/events.ts
index 5c107e7aa1..eeb5227c55 100644
--- a/packages/frontend/track/src/events.ts
+++ b/packages/frontend/track/src/events.ts
@@ -443,14 +443,6 @@ type AttachmentEventArgs = {
type: string; // file type
};
-type DocRoleControlType =
- | 'Owner'
- | 'Editor'
- | 'Manager'
- | 'Reader'
- | 'External'
- | 'Remove';
-
type TabActionControlType =
| 'click'
| 'dnd'
@@ -546,12 +538,8 @@ export type EventArgs = {
openAttachmentInNewTab: AttachmentEventArgs;
openAttachmentInPeekView: AttachmentEventArgs;
openAttachmentInSplitView: AttachmentEventArgs;
- modifyUserDocRole: {
- control: DocRoleControlType;
- };
- modifyDocDefaultRole: {
- control: DocRoleControlType;
- };
+ modifyUserDocRole: { role: string };
+ modifyDocDefaultRole: { role: string };
inviteUserDocRole: {
control: 'member list';
};