mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: updated project member invite events
This commit is contained in:
parent
d263335a29
commit
6108f98adb
@ -11,10 +11,12 @@ import { ConfirmProjectMemberRemove } from "components/project";
|
||||
import { CustomSelect, Tooltip } from "@plane/ui";
|
||||
// icons
|
||||
import { ChevronDown, Dot, XCircle } from "lucide-react";
|
||||
// helpers
|
||||
import { getUserRole } from "helpers/user.helper";
|
||||
// constants
|
||||
import { ROLE } from "constants/workspace";
|
||||
import { EUserProjectRoles } from "constants/project";
|
||||
import { PROJECT_MEMBER_LEAVE } from "constants/event-tracker";
|
||||
import { PM_ROLE_CHANGED, PROJECT_MEMBER_LEAVE, PROJECT_MEMBER_REMOVED } from "constants/event-tracker";
|
||||
|
||||
type Props = {
|
||||
userId: string;
|
||||
@ -65,14 +67,23 @@ export const ProjectMemberListItem: React.FC<Props> = observer((props) => {
|
||||
})
|
||||
);
|
||||
} else
|
||||
await removeMemberFromProject(workspaceSlug.toString(), projectId.toString(), userDetails.member.id).catch(
|
||||
(err) =>
|
||||
await removeMemberFromProject(workspaceSlug.toString(), projectId.toString(), userDetails.member.id)
|
||||
.then(() => {
|
||||
captureEvent(PROJECT_MEMBER_REMOVED, {
|
||||
member_id: userDetails.member.id,
|
||||
role: getUserRole(userDetails.role as number),
|
||||
removed_by_role : getUserRole(currentProjectRole as number),
|
||||
state: "SUCCESS",
|
||||
element: "Project settings members page",
|
||||
});
|
||||
})
|
||||
.catch((err) =>
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error",
|
||||
message: err?.error || "Something went wrong. Please try again.",
|
||||
})
|
||||
);
|
||||
);
|
||||
};
|
||||
|
||||
if (!userDetails) return null;
|
||||
@ -147,16 +158,25 @@ export const ProjectMemberListItem: React.FC<Props> = observer((props) => {
|
||||
|
||||
updateMember(workspaceSlug.toString(), projectId.toString(), userDetails.member.id, {
|
||||
role: value,
|
||||
}).catch((err) => {
|
||||
const error = err.error;
|
||||
const errorString = Array.isArray(error) ? error[0] : error;
|
||||
})
|
||||
.then(() => {
|
||||
captureEvent(PM_ROLE_CHANGED, {
|
||||
member_id: userDetails.member.id,
|
||||
changed_role: getUserRole(value as number),
|
||||
state: "SUCCESS",
|
||||
element: "Project settings members page",
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
const error = err.error;
|
||||
const errorString = Array.isArray(error) ? error[0] : error;
|
||||
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
message: errorString ?? "An error occurred while updating member role. Please try again.",
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
message: errorString ?? "An error occurred while updating member role. Please try again.",
|
||||
});
|
||||
});
|
||||
});
|
||||
}}
|
||||
disabled={
|
||||
userDetails.member.id === currentUser?.id || !currentProjectRole || currentProjectRole < userDetails.role
|
||||
|
@ -88,12 +88,8 @@ export const SendProjectInvitationModal: React.FC<Props> = observer((props) => {
|
||||
message: "Members added successfully.",
|
||||
});
|
||||
captureEvent(PROJECT_MEMBER_ADDED, {
|
||||
members: [
|
||||
...payload.members.map((member) => ({
|
||||
member_id: member.member_id,
|
||||
role: ROLE[member.role],
|
||||
})),
|
||||
],
|
||||
member_id: payload.members?.[0]?.member_id,
|
||||
role: ROLE[payload.members?.[0]?.role],
|
||||
state: "SUCCESS",
|
||||
element: "Project settings members page",
|
||||
});
|
||||
|
@ -250,6 +250,8 @@ export const MEMBER_INVITED = "Member invited";
|
||||
export const MEMBER_ACCEPTED = "Member accepted";
|
||||
export const PROJECT_MEMBER_ADDED = "Project member added";
|
||||
export const PROJECT_MEMBER_LEAVE = "Project member leave";
|
||||
export const PROJECT_MEMBER_REMOVED = "Project member removed";
|
||||
export const PM_ROLE_CHANGED = "Project member role changed";
|
||||
export const WORKSPACE_MEMBER_lEAVE = "Workspace member leave";
|
||||
// Sign-in & Sign-up Events
|
||||
export const NAVIGATE_TO_SIGNUP = "Navigate to sign-up page";
|
||||
|
Loading…
Reference in New Issue
Block a user