From 981acc81c193f8d1aae3405b37e4c812cb923d04 Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:01:43 +0530 Subject: [PATCH] fix: replaced first name, last name or email to display name (#1796) * fix: replacing first, last name and email with display name * fix: different endpoint for workspace & project member * fix: falling back to email if display_name doesn't exist --- .../custom-analytics/graph/custom-tooltip.tsx | 10 +- .../custom-analytics/graph/index.tsx | 6 +- .../analytics/custom-analytics/sidebar.tsx | 9 +- .../analytics/custom-analytics/table.tsx | 187 ++++++++---------- .../scope-and-demand/leaderboard.tsx | 10 +- .../scope-and-demand/scope-and-demand.tsx | 4 +- .../analytics/scope-and-demand/scope.tsx | 9 +- .../issue/change-issue-assignee.tsx | 7 +- .../components/core/filters/filters-list.tsx | 6 +- .../components/core/sidebar/links-list.tsx | 2 +- .../core/sidebar/sidebar-progress-stats.tsx | 3 +- .../core/views/board-view/board-header.tsx | 9 +- .../core/views/list-view/single-list.tsx | 11 +- .../cycles/active-cycle-details.tsx | 6 +- .../components/cycles/active-cycle-stats.tsx | 3 +- apps/app/components/cycles/sidebar.tsx | 6 +- .../components/cycles/single-cycle-card.tsx | 6 +- .../components/cycles/single-cycle-list.tsx | 4 +- .../integration/github/single-user-select.tsx | 13 +- .../integration/jira/import-users.tsx | 11 +- .../components/integration/single-import.tsx | 7 +- apps/app/components/issues/activity.tsx | 7 +- .../issues/attachment/attachments.tsx | 2 +- .../issues/comment/comment-card.tsx | 9 +- .../app/components/issues/select/assignee.tsx | 13 +- .../issues/sidebar-select/assignee.tsx | 13 +- .../issues/view-select/assignee.tsx | 19 +- apps/app/components/modules/select/lead.tsx | 17 +- .../app/components/modules/select/members.tsx | 11 +- .../modules/sidebar-select/select-lead.tsx | 17 +- .../modules/sidebar-select/select-members.tsx | 11 +- .../notifications/notification-card.tsx | 9 +- .../pages/single-page-detailed-item.tsx | 2 +- .../pages/single-page-list-item.tsx | 2 +- .../components/profile/overview/activity.tsx | 6 +- .../profile/profile-issues-view.tsx | 6 +- apps/app/components/profile/sidebar.tsx | 14 +- .../project/confirm-project-member-remove.tsx | 6 +- .../project/create-project-modal.tsx | 18 +- .../project/send-project-invitation-modal.tsx | 11 +- apps/app/components/search-listbox/index.tsx | 4 +- apps/app/components/ui/avatar.tsx | 6 +- apps/app/components/views/select-filters.tsx | 8 +- .../confirm-workspace-member-remove.tsx | 6 +- .../components/workspace/sidebar-dropdown.tsx | 2 +- .../workspace/single-invitation.tsx | 4 +- apps/app/constants/analytics.ts | 2 +- apps/app/constants/fetch-keys.ts | 8 + apps/app/constants/spreadsheet.ts | 4 +- .../[workspaceSlug]/me/profile/activity.tsx | 16 +- .../[workspaceSlug]/me/profile/index.tsx | 2 +- .../projects/[projectId]/settings/control.tsx | 20 +- .../projects/[projectId]/settings/members.tsx | 41 ++-- .../[workspaceSlug]/settings/members.tsx | 38 ++-- apps/app/pages/api/track-event.ts | 1 + apps/app/services/project.service.ts | 22 +++ apps/app/services/workspace.service.ts | 18 ++ apps/app/types/analytics.d.ts | 8 +- apps/app/types/cycles.d.ts | 1 + apps/app/types/projects.d.ts | 3 +- apps/app/types/users.d.ts | 9 +- apps/app/types/workspace.d.ts | 5 +- 62 files changed, 332 insertions(+), 418 deletions(-) diff --git a/apps/app/components/analytics/custom-analytics/graph/custom-tooltip.tsx b/apps/app/components/analytics/custom-analytics/graph/custom-tooltip.tsx index 573cda25c90..e2698ccd2a2 100644 --- a/apps/app/components/analytics/custom-analytics/graph/custom-tooltip.tsx +++ b/apps/app/components/analytics/custom-analytics/graph/custom-tooltip.tsx @@ -16,15 +16,7 @@ export const CustomTooltip: React.FC = ({ datum, analytics, params }) => if (params.segment) { if (DATE_KEYS.includes(params.segment)) tooltipValue = renderMonthAndYear(datum.id); - else if (params.segment === "assignees__email") { - const assignee = analytics.extras.assignee_details.find( - (a) => a.assignees__email === datum.id - ); - - if (assignee) - tooltipValue = assignee.assignees__first_name + " " + assignee.assignees__last_name; - else tooltipValue = "No assignees"; - } else tooltipValue = datum.id; + else tooltipValue = datum.id; } else { if (DATE_KEYS.includes(params.x_axis)) tooltipValue = datum.indexValue; else tooltipValue = datum.id === "count" ? "Issue count" : "Estimate"; diff --git a/apps/app/components/analytics/custom-analytics/graph/index.tsx b/apps/app/components/analytics/custom-analytics/graph/index.tsx index 3f70dddc51f..bde8c82ec2b 100644 --- a/apps/app/components/analytics/custom-analytics/graph/index.tsx +++ b/apps/app/components/analytics/custom-analytics/graph/index.tsx @@ -70,17 +70,17 @@ export const AnalyticsGraph: React.FC = ({ height={fullScreen ? "400px" : "300px"} margin={{ right: 20, - bottom: params.x_axis === "assignees__email" ? 50 : longestXAxisLabel.length * 5 + 20, + bottom: params.x_axis === "assignees__id" ? 50 : longestXAxisLabel.length * 5 + 20, }} axisBottom={{ tickSize: 0, tickPadding: 10, tickRotation: barGraphData.data.length > 7 ? -45 : 0, renderTick: - params.x_axis === "assignees__email" + params.x_axis === "assignees__id" ? (datum) => { const avatar = analytics.extras.assignee_details?.find( - (a) => a?.assignees__email === datum?.value + (a) => a?.assignees__display_name === datum?.value )?.assignees__avatar; if (avatar && avatar !== "") diff --git a/apps/app/components/analytics/custom-analytics/sidebar.tsx b/apps/app/components/analytics/custom-analytics/sidebar.tsx index d1a29da4121..6189f325bd0 100644 --- a/apps/app/components/analytics/custom-analytics/sidebar.tsx +++ b/apps/app/components/analytics/custom-analytics/sidebar.tsx @@ -277,9 +277,7 @@ export const AnalyticsSidebar: React.FC = ({
Lead
- - {cycleDetails.owned_by?.first_name} {cycleDetails.owned_by?.last_name} - + {cycleDetails.owned_by?.display_name}
Start Date
@@ -305,10 +303,7 @@ export const AnalyticsSidebar: React.FC = ({
Lead
- - {moduleDetails.lead_detail?.first_name}{" "} - {moduleDetails.lead_detail?.last_name} - + {moduleDetails.lead_detail?.display_name}
Start Date
diff --git a/apps/app/components/analytics/custom-analytics/table.tsx b/apps/app/components/analytics/custom-analytics/table.tsx index 92eac5085ea..361f2d7f200 100644 --- a/apps/app/components/analytics/custom-analytics/table.tsx +++ b/apps/app/components/analytics/custom-analytics/table.tsx @@ -21,115 +21,96 @@ type Props = { yAxisKey: "count" | "estimate"; }; -export const AnalyticsTable: React.FC = ({ analytics, barGraphData, params, yAxisKey }) => { - const renderAssigneeName = (email: string): string => { - const assignee = analytics.extras.assignee_details.find((a) => a.assignees__email === email); - - if (!assignee) return "No assignee"; - - if (assignee.assignees__first_name !== "") - return assignee.assignees__first_name + " " + assignee.assignees__last_name; - - return email; - }; - - return ( -
-
-
- - - -
- {ANALYTICS_X_AXIS_VALUES.find((v) => v.value === params.x_axis)?.label} +export const AnalyticsTable: React.FC = ({ analytics, barGraphData, params, yAxisKey }) => ( +
+
+
+ + + + + {params.segment ? ( + barGraphData.xAxisKeys.map((key) => ( + + )) + ) : ( + + )} + + + + {barGraphData.data.map((item, index) => ( + + {params.segment ? ( - barGraphData.xAxisKeys.map((key) => ( - )) ) : ( - + )} - - - {barGraphData.data.map((item, index) => ( - - - {params.segment ? ( - barGraphData.xAxisKeys.map((key, index) => ( - - )) - ) : ( - - )} - - ))} - -
+ {ANALYTICS_X_AXIS_VALUES.find((v) => v.value === params.x_axis)?.label} + +
+ {params.segment === "priority" ? ( + getPriorityIcon(key) + ) : ( + + )} + {DATE_KEYS.includes(params.segment ?? "") ? renderMonthAndYear(key) : key} +
+
+ {ANALYTICS_Y_AXIS_VALUES.find((v) => v.value === params.y_axis)?.label}
+ {params.x_axis === "priority" ? ( + getPriorityIcon(`${item.name}`) + ) : ( + + )} + {addSpaceIfCamelCase(`${item.name}`)} + ( + -
- {params.segment === "priority" ? ( - getPriorityIcon(key) - ) : ( - - )} - {DATE_KEYS.includes(params.segment ?? "") - ? renderMonthAndYear(key) - : params.segment === "assignees__email" - ? renderAssigneeName(key) - : key} -
- + {item[key] ?? 0} +
- {ANALYTICS_Y_AXIS_VALUES.find((v) => v.value === params.y_axis)?.label} - {item[yAxisKey]}
- {params.x_axis === "priority" ? ( - getPriorityIcon(`${item.name}`) - ) : ( - - )} - {params.x_axis === "assignees__email" - ? renderAssigneeName(`${item.name}`) - : addSpaceIfCamelCase(`${item.name}`)} - - {item[key] ?? 0} - {item[yAxisKey]}
-
+ ))} + +
- ); -}; +
+); diff --git a/apps/app/components/analytics/scope-and-demand/leaderboard.tsx b/apps/app/components/analytics/scope-and-demand/leaderboard.tsx index 081fc6302de..c22f60aa9e1 100644 --- a/apps/app/components/analytics/scope-and-demand/leaderboard.tsx +++ b/apps/app/components/analytics/scope-and-demand/leaderboard.tsx @@ -1,7 +1,7 @@ type Props = { users: { avatar: string | null; - email: string | null; + display_name: string | null; firstName: string; lastName: string; count: number; @@ -16,7 +16,7 @@ export const AnalyticsLeaderboard: React.FC = ({ users, title }) => (
{users.map((user) => (
@@ -25,16 +25,16 @@ export const AnalyticsLeaderboard: React.FC = ({ users, title }) => ( {user.email
) : (
- {user.firstName !== "" ? user.firstName[0] : "?"} + {user.display_name !== "" ? user?.display_name?.[0] : "?"}
)} - {user.firstName !== "" ? `${user.firstName} ${user.lastName}` : "No assignee"} + {user.display_name !== "" ? `${user.display_name}` : "No assignee"}
{user.count} diff --git a/apps/app/components/analytics/scope-and-demand/scope-and-demand.tsx b/apps/app/components/analytics/scope-and-demand/scope-and-demand.tsx index cfc315ac18c..c4acf8f4550 100644 --- a/apps/app/components/analytics/scope-and-demand/scope-and-demand.tsx +++ b/apps/app/components/analytics/scope-and-demand/scope-and-demand.tsx @@ -56,9 +56,9 @@ export const ScopeAndDemand: React.FC = ({ fullScreen = true }) => { ({ avatar: user?.created_by__avatar, - email: user?.created_by__email, firstName: user?.created_by__first_name, lastName: user?.created_by__last_name, + display_name: user?.created_by__display_name, count: user?.count, }))} title="Most issues created" @@ -66,9 +66,9 @@ export const ScopeAndDemand: React.FC = ({ fullScreen = true }) => { ({ avatar: user?.assignees__avatar, - email: user?.assignees__email, firstName: user?.assignees__first_name, lastName: user?.assignees__last_name, + display_name: user?.assignees__display_name, count: user?.count, }))} title="Most issues closed" diff --git a/apps/app/components/analytics/scope-and-demand/scope.tsx b/apps/app/components/analytics/scope-and-demand/scope.tsx index ac605c8f919..15b9e18de5e 100644 --- a/apps/app/components/analytics/scope-and-demand/scope.tsx +++ b/apps/app/components/analytics/scope-and-demand/scope.tsx @@ -16,23 +16,20 @@ export const AnalyticsScope: React.FC = ({ defaultAnalytics }) => ( {defaultAnalytics.pending_issue_user.length > 0 ? ( `#f97316`} customYAxisTickValues={defaultAnalytics.pending_issue_user.map((d) => d.count)} tooltip={(datum) => { const assignee = defaultAnalytics.pending_issue_user.find( - (a) => a.assignees__email === `${datum.indexValue}` + (a) => a.assignees__display_name === `${datum.indexValue}` ); return (
- {assignee - ? assignee.assignees__first_name + " " + assignee.assignees__last_name - : "No assignee"} - :{" "} + {assignee ? assignee.assignees__display_name : "No assignee"}:{" "} {datum.value}
diff --git a/apps/app/components/command-palette/issue/change-issue-assignee.tsx b/apps/app/components/command-palette/issue/change-issue-assignee.tsx index e272839bdbc..ad3d4dfdb32 100644 --- a/apps/app/components/command-palette/issue/change-issue-assignee.tsx +++ b/apps/app/components/command-palette/issue/change-issue-assignee.tsx @@ -34,15 +34,12 @@ export const ChangeIssueAssignee: React.FC = ({ setIsPaletteOpen, issue, const options = members?.map(({ member }) => ({ value: member.id, - query: - (member.first_name && member.first_name !== "" ? member.first_name : member.email) + - " " + - member.last_name ?? "", + query: member.display_name, content: ( <>
- {member.first_name && member.first_name !== "" ? member.first_name : member.email} + {member.display_name}
{issue.assignees.includes(member.id) && (
diff --git a/apps/app/components/core/filters/filters-list.tsx b/apps/app/components/core/filters/filters-list.tsx index 12ae9f4c9af..ffe59625826 100644 --- a/apps/app/components/core/filters/filters-list.tsx +++ b/apps/app/components/core/filters/filters-list.tsx @@ -157,10 +157,10 @@ export const FiltersList: React.FC = ({ return (
- {member?.first_name} + {member?.display_name} @@ -184,7 +184,7 @@ export const FiltersList: React.FC = ({ className="inline-flex items-center gap-x-1 rounded-full bg-custom-background-90 px-1 capitalize" > - {member?.first_name} + {member?.display_name} diff --git a/apps/app/components/core/sidebar/links-list.tsx b/apps/app/components/core/sidebar/links-list.tsx index e9f8e9039c8..af008fec4fa 100644 --- a/apps/app/components/core/sidebar/links-list.tsx +++ b/apps/app/components/core/sidebar/links-list.tsx @@ -62,7 +62,7 @@ export const LinksList: React.FC = ({ links, handleDeleteLink, userAuth } by{" "} {link.created_by_detail.is_bot ? link.created_by_detail.first_name + " Bot" - : link.created_by_detail.email} + : link.created_by_detail.display_name}

diff --git a/apps/app/components/core/sidebar/sidebar-progress-stats.tsx b/apps/app/components/core/sidebar/sidebar-progress-stats.tsx index 062c16eb5d4..a224bb773b6 100644 --- a/apps/app/components/core/sidebar/sidebar-progress-stats.tsx +++ b/apps/app/components/core/sidebar/sidebar-progress-stats.tsx @@ -133,9 +133,10 @@ export const SidebarProgressStats: React.FC = ({ avatar: assignee.avatar ?? "", first_name: assignee.first_name ?? "", last_name: assignee.last_name ?? "", + display_name: assignee.display_name ?? "", }} /> - {assignee.first_name} + {assignee.display_name}
} completed={assignee.completed_issues} diff --git a/apps/app/components/core/views/board-view/board-header.tsx b/apps/app/components/core/views/board-view/board-header.tsx index 5da92921ef6..6e87d1810ce 100644 --- a/apps/app/components/core/views/board-view/board-header.tsx +++ b/apps/app/components/core/views/board-view/board-header.tsx @@ -81,10 +81,7 @@ export const BoardHeader: React.FC = ({ break; case "created_by": const member = members?.find((member) => member.member.id === groupTitle)?.member; - title = - member?.first_name && member.first_name !== "" - ? `${member.first_name} ${member.last_name}` - : member?.email ?? ""; + title = member?.display_name ?? ""; break; } @@ -149,7 +146,9 @@ export const BoardHeader: React.FC = ({ > {getGroupIcon()}

= ({ break; case "created_by": const member = members?.find((member) => member.member.id === groupTitle)?.member; - title = - member?.first_name && member.first_name !== "" - ? `${member.first_name} ${member.last_name}` - : member?.email ?? ""; + title = member?.display_name ?? ""; break; } @@ -163,7 +160,11 @@ export const SingleList: React.FC = ({
{getGroupIcon()}
)} {selectedGroup !== null ? ( -

+

{getGroupTitle()}

) : ( diff --git a/apps/app/components/cycles/active-cycle-details.tsx b/apps/app/components/cycles/active-cycle-details.tsx index eb0cdc7d8ad..bec200bd959 100644 --- a/apps/app/components/cycles/active-cycle-details.tsx +++ b/apps/app/components/cycles/active-cycle-details.tsx @@ -361,14 +361,14 @@ export const ActiveCycleDetails: React.FC = () => { height={16} width={16} className="rounded-full" - alt={cycle.owned_by.first_name} + alt={cycle.owned_by.display_name} /> ) : ( - {cycle.owned_by.first_name.charAt(0)} + {cycle.owned_by.display_name.charAt(0)} )} - {cycle.owned_by.first_name} + {cycle.owned_by.display_name}

{cycle.assignees.length > 0 && ( diff --git a/apps/app/components/cycles/active-cycle-stats.tsx b/apps/app/components/cycles/active-cycle-stats.tsx index d51c5da41de..e26b4480361 100644 --- a/apps/app/components/cycles/active-cycle-stats.tsx +++ b/apps/app/components/cycles/active-cycle-stats.tsx @@ -88,9 +88,10 @@ export const ActiveCycleProgressStats: React.FC = ({ cycle }) => { avatar: assignee.avatar ?? "", first_name: assignee.first_name ?? "", last_name: assignee.last_name ?? "", + display_name: assignee.display_name ?? "", }} /> - {assignee.first_name} + {assignee.display_name}
} completed={assignee.completed_issues} diff --git a/apps/app/components/cycles/sidebar.tsx b/apps/app/components/cycles/sidebar.tsx index 48edb717859..dafb1b6c265 100644 --- a/apps/app/components/cycles/sidebar.tsx +++ b/apps/app/components/cycles/sidebar.tsx @@ -450,14 +450,14 @@ export const CycleDetailsSidebar: React.FC = ({ height={12} width={12} className="rounded-full" - alt={cycle.owned_by.first_name} + alt={cycle.owned_by.display_name} /> ) : ( - {cycle.owned_by.first_name.charAt(0)} + {cycle.owned_by.display_name.charAt(0)} )} - {cycle.owned_by.first_name} + {cycle.owned_by.display_name}
diff --git a/apps/app/components/cycles/single-cycle-card.tsx b/apps/app/components/cycles/single-cycle-card.tsx index f18d0e5886a..8808940f1fc 100644 --- a/apps/app/components/cycles/single-cycle-card.tsx +++ b/apps/app/components/cycles/single-cycle-card.tsx @@ -250,14 +250,14 @@ export const SingleCycleCard: React.FC = ({ height={16} width={16} className="rounded-full" - alt={cycle.owned_by.first_name} + alt={cycle.owned_by.display_name} /> ) : ( - {cycle.owned_by.first_name.charAt(0)} + {cycle.owned_by.display_name.charAt(0)} )} - {cycle.owned_by.first_name} + {cycle.owned_by.display_name}
diff --git a/apps/app/components/cycles/single-cycle-list.tsx b/apps/app/components/cycles/single-cycle-list.tsx index 32bd18539ee..813264986f3 100644 --- a/apps/app/components/cycles/single-cycle-list.tsx +++ b/apps/app/components/cycles/single-cycle-list.tsx @@ -254,11 +254,11 @@ export const SingleCycleList: React.FC = ({ height={16} width={16} className="rounded-full" - alt={cycle.owned_by.first_name} + alt={cycle.owned_by.display_name} /> ) : ( - {cycle.owned_by.first_name.charAt(0)} + {cycle.owned_by.display_name.charAt(0)} )}
diff --git a/apps/app/components/integration/github/single-user-select.tsx b/apps/app/components/integration/github/single-user-select.tsx index 01e1f232791..13671ac8930 100644 --- a/apps/app/components/integration/github/single-user-select.tsx +++ b/apps/app/components/integration/github/single-user-select.tsx @@ -44,19 +44,12 @@ export const SingleUserSelect: React.FC = ({ collaborator, index, users, ); const options = members?.map((member) => ({ - value: member.member.email, - query: - (member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email) + - " " + - member.member.last_name ?? "", + value: member.member.display_name, + query: member.member.display_name ?? "", content: (
- {member.member.first_name && member.member.first_name !== "" - ? member.member.first_name + "(" + member.member.email + ")" - : member.member.email} + {member.member.display_name}
), })); diff --git a/apps/app/components/integration/jira/import-users.tsx b/apps/app/components/integration/jira/import-users.tsx index f73481dcd83..53620f04751 100644 --- a/apps/app/components/integration/jira/import-users.tsx +++ b/apps/app/components/integration/jira/import-users.tsx @@ -34,18 +34,11 @@ export const JiraImportUsers: FC = () => { const options = members?.map((member) => ({ value: member.member.email, - query: - (member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email) + - " " + - member.member.last_name ?? "", + query: member.member.display_name ?? "", content: (
- {member.member.first_name && member.member.first_name !== "" - ? member.member.first_name + " (" + member.member.email + ")" - : member.member.email} + {member.member.display_name}
), })); diff --git a/apps/app/components/integration/single-import.tsx b/apps/app/components/integration/single-import.tsx index 56ee0adf80e..b74628a83bb 100644 --- a/apps/app/components/integration/single-import.tsx +++ b/apps/app/components/integration/single-import.tsx @@ -42,12 +42,7 @@ export const SingleImport: React.FC = ({ service, refreshing, handleDelet
{renderShortDateWithYearFormat(service.created_at)}| - - Imported by{" "} - {service.initiated_by_detail.first_name && service.initiated_by_detail.first_name !== "" - ? service.initiated_by_detail.first_name + " " + service.initiated_by_detail.last_name - : service.initiated_by_detail.email} - + Imported by {service.initiated_by_detail.display_name}
diff --git a/apps/app/components/issues/activity.tsx b/apps/app/components/issues/activity.tsx index 54dc3961398..9eb5d0c8b53 100644 --- a/apps/app/components/issues/activity.tsx +++ b/apps/app/components/issues/activity.tsx @@ -122,7 +122,7 @@ export const IssueActivitySection: React.FC = ({ issueId, user }) => { activityItem.actor_detail.avatar !== "" ? ( {activityItem.actor_detail.first_name} = ({ issueId, user }) => {
- {activityItem.actor_detail.first_name.charAt(0)} + {activityItem.actor_detail.display_name.charAt(0)}
)} @@ -150,8 +150,7 @@ export const IssueActivitySection: React.FC = ({ issueId, user }) => { ) : ( - {activityItem.actor_detail.first_name}{" "} - {activityItem.actor_detail.last_name} + {activityItem.actor_detail.display_name} )}{" "} diff --git a/apps/app/components/issues/attachment/attachments.tsx b/apps/app/components/issues/attachment/attachments.tsx index 67b5be5db86..4ec598d1a8f 100644 --- a/apps/app/components/issues/attachment/attachments.tsx +++ b/apps/app/components/issues/attachment/attachments.tsx @@ -77,7 +77,7 @@ export const IssueAttachments = () => { person.member.id === file.updated_by)?.member - .first_name ?? "" + .display_name ?? "" } uploaded on ${renderLongDateFormat(file.updated_at)}`} > diff --git a/apps/app/components/issues/comment/comment-card.tsx b/apps/app/components/issues/comment/comment-card.tsx index 987254f3b57..6805c377a7e 100644 --- a/apps/app/components/issues/comment/comment-card.tsx +++ b/apps/app/components/issues/comment/comment-card.tsx @@ -70,7 +70,7 @@ export const CommentCard: React.FC = ({ comment, onSubmit, handleCommentD {comment.actor_detail.avatar && comment.actor_detail.avatar !== "" ? ( {comment.actor_detail.first_name} = ({ comment, onSubmit, handleCommentD
- {comment.actor_detail.first_name.charAt(0)} + {comment.actor_detail.display_name.charAt(0)}
)} @@ -93,8 +93,9 @@ export const CommentCard: React.FC = ({ comment, onSubmit, handleCommentD
- {comment.actor_detail.first_name} - {comment.actor_detail.is_bot ? "Bot" : " " + comment.actor_detail.last_name} + {comment.actor_detail.is_bot + ? comment.actor_detail.first_name + " Bot" + : comment.actor_detail.display_name}

Commented {timeAgo(comment.created_at)} diff --git a/apps/app/components/issues/select/assignee.tsx b/apps/app/components/issues/select/assignee.tsx index 47fe07c42a0..27805548488 100644 --- a/apps/app/components/issues/select/assignee.tsx +++ b/apps/app/components/issues/select/assignee.tsx @@ -30,20 +30,11 @@ export const IssueAssigneeSelect: React.FC = ({ projectId, value = [], on const options = members?.map((member) => ({ value: member.member.id, - query: - (member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email) + - " " + - member.member.last_name ?? "", + query: member.member.display_name ?? "", content: (

- {`${ - member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email - } ${member.member.last_name ?? ""}`} + {member.member.display_name}
), })); diff --git a/apps/app/components/issues/sidebar-select/assignee.tsx b/apps/app/components/issues/sidebar-select/assignee.tsx index f625952e37d..323d201e8eb 100644 --- a/apps/app/components/issues/sidebar-select/assignee.tsx +++ b/apps/app/components/issues/sidebar-select/assignee.tsx @@ -41,20 +41,11 @@ export const SidebarAssigneeSelect: React.FC = ({ const options = members?.map((member) => ({ value: member.member.id, - query: - (member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email) + - " " + - member.member.last_name ?? "", + query: member.member.display_name, content: (
- {`${ - member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email - } ${member.member.last_name ?? ""}`} + {member.member.display_name}
), })); diff --git a/apps/app/components/issues/view-select/assignee.tsx b/apps/app/components/issues/view-select/assignee.tsx index 8cd3bb317c8..0c9e9bd2703 100644 --- a/apps/app/components/issues/view-select/assignee.tsx +++ b/apps/app/components/issues/view-select/assignee.tsx @@ -47,20 +47,11 @@ export const ViewAssigneeSelect: React.FC = ({ const options = members?.map((member) => ({ value: member.member.id, - query: - (member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email) + - " " + - member.member.last_name ?? "", + query: member.member.display_name, content: (
- {`${ - member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email - } ${member.member.last_name ?? ""}`} + {member.member.display_name}
), })); @@ -71,11 +62,7 @@ export const ViewAssigneeSelect: React.FC = ({ tooltipHeading="Assignees" tooltipContent={ issue.assignee_details.length > 0 - ? issue.assignee_details - .map((assignee) => - assignee?.first_name !== "" ? assignee?.first_name : assignee?.email - ) - .join(", ") + ? issue.assignee_details.map((assignee) => assignee?.display_name).join(", ") : "No Assignee" } > diff --git a/apps/app/components/modules/select/lead.tsx b/apps/app/components/modules/select/lead.tsx index 441cb673ae4..e102cc21f8c 100644 --- a/apps/app/components/modules/select/lead.tsx +++ b/apps/app/components/modules/select/lead.tsx @@ -32,18 +32,11 @@ export const ModuleLeadSelect: React.FC = ({ value, onChange }) => { const options = members?.map((member) => ({ value: member.member.id, - query: - (member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email) + - " " + - member.member.last_name ?? "", + query: member.member.display_name, content: (
- {member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email} + {member.member.display_name}
), })); @@ -62,11 +55,7 @@ export const ModuleLeadSelect: React.FC = ({ value, onChange }) => { )} {selectedOption ? ( - selectedOption?.first_name && selectedOption.first_name !== "" ? ( - selectedOption?.first_name - ) : ( - selectedOption?.email - ) + selectedOption?.display_name ) : ( Lead )} diff --git a/apps/app/components/modules/select/members.tsx b/apps/app/components/modules/select/members.tsx index e7ace406043..a6e75f3a6f6 100644 --- a/apps/app/components/modules/select/members.tsx +++ b/apps/app/components/modules/select/members.tsx @@ -30,18 +30,11 @@ export const ModuleMembersSelect: React.FC = ({ value, onChange }) => { ); const options = members?.map((member) => ({ value: member.member.id, - query: - (member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email) + - " " + - member.member.last_name ?? "", + query: member.member.display_name, content: (
- {member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email} + {member.member.display_name}
), })); diff --git a/apps/app/components/modules/sidebar-select/select-lead.tsx b/apps/app/components/modules/sidebar-select/select-lead.tsx index 167d1665ae7..e00a5db2535 100644 --- a/apps/app/components/modules/sidebar-select/select-lead.tsx +++ b/apps/app/components/modules/sidebar-select/select-lead.tsx @@ -33,18 +33,11 @@ export const SidebarLeadSelect: React.FC = ({ value, onChange }) => { const options = members?.map((member) => ({ value: member.member.id, - query: - (member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email) + - " " + - member.member.last_name ?? "", + query: member.member.display_name, content: (
- {member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email} + {member.member.display_name}
), })); @@ -64,11 +57,7 @@ export const SidebarLeadSelect: React.FC = ({ value, onChange }) => {
{selectedOption && } {selectedOption ? ( - selectedOption?.first_name && selectedOption.first_name !== "" ? ( - selectedOption?.first_name - ) : ( - selectedOption?.email - ) + selectedOption?.display_name ) : ( No lead )} diff --git a/apps/app/components/modules/sidebar-select/select-members.tsx b/apps/app/components/modules/sidebar-select/select-members.tsx index af530503a53..185f70cec45 100644 --- a/apps/app/components/modules/sidebar-select/select-members.tsx +++ b/apps/app/components/modules/sidebar-select/select-members.tsx @@ -31,18 +31,11 @@ export const SidebarMembersSelect: React.FC = ({ value, onChange }) => { const options = members?.map((member) => ({ value: member.member.id, - query: - (member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email) + - " " + - member.member.last_name ?? "", + query: member.member.display_name, content: (
- {member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email} + {member.member.display_name}
), })); diff --git a/apps/app/components/notifications/notification-card.tsx b/apps/app/components/notifications/notification-card.tsx index 3a0d2f9b88d..9733a0f5b21 100644 --- a/apps/app/components/notifications/notification-card.tsx +++ b/apps/app/components/notifications/notification-card.tsx @@ -78,8 +78,8 @@ export const NotificationCard: React.FC = (props) => { ) : (
- {notification.triggered_by_details.first_name?.[0] ? ( - notification.triggered_by_details.first_name?.[0]?.toUpperCase() + {notification.triggered_by_details.display_name?.[0] ? ( + notification.triggered_by_details.display_name?.[0]?.toUpperCase() ) : ( )} @@ -89,10 +89,7 @@ export const NotificationCard: React.FC = (props) => {
- - {notification.triggered_by_details.first_name}{" "} - {notification.triggered_by_details.last_name}{" "} - + {notification.triggered_by_details.display_name} {notification.data.issue_activity.field !== "comment" && notification.data.issue_activity.verb}{" "} {notification.data.issue_activity.field === "comment" diff --git a/apps/app/components/pages/single-page-detailed-item.tsx b/apps/app/components/pages/single-page-detailed-item.tsx index 928ddb935db..eca4df9f182 100644 --- a/apps/app/components/pages/single-page-detailed-item.tsx +++ b/apps/app/components/pages/single-page-detailed-item.tsx @@ -162,7 +162,7 @@ export const SinglePageDetailedItem: React.FC = ({ position="top-right" tooltipContent={`Created by ${ people?.find((person) => person.member.id === page.created_by)?.member - .first_name ?? "" + .display_name ?? "" } on ${renderLongDateFormat(`${page.created_at}`)}`} > diff --git a/apps/app/components/pages/single-page-list-item.tsx b/apps/app/components/pages/single-page-list-item.tsx index e60e2d304c1..44a6ab6a9c2 100644 --- a/apps/app/components/pages/single-page-list-item.tsx +++ b/apps/app/components/pages/single-page-list-item.tsx @@ -161,7 +161,7 @@ export const SinglePageListItem: React.FC = ({ position="top-right" tooltipContent={`Created by ${ people?.find((person) => person.member.id === page.created_by)?.member - .first_name ?? "" + .display_name ?? "" } on ${renderLongDateFormat(`${page.created_at}`)}`} > diff --git a/apps/app/components/profile/overview/activity.tsx b/apps/app/components/profile/overview/activity.tsx index eb34780208a..78d5e2f64a0 100644 --- a/apps/app/components/profile/overview/activity.tsx +++ b/apps/app/components/profile/overview/activity.tsx @@ -38,21 +38,21 @@ export const ProfileActivity = () => { {activity.actor_detail.avatar && activity.actor_detail.avatar !== "" ? ( {activity.actor_detail.first_name} ) : (
- {activity.actor_detail.first_name.charAt(0)} + {activity.actor_detail.display_name?.charAt(0)}
)}

- {activity.actor_detail.first_name} {activity.actor_detail.last_name}{" "} + {activity.actor_detail.display_name}{" "} {activity.field ? ( diff --git a/apps/app/components/profile/profile-issues-view.tsx b/apps/app/components/profile/profile-issues-view.tsx index 401ac22d377..0b63f87a5be 100644 --- a/apps/app/components/profile/profile-issues-view.tsx +++ b/apps/app/components/profile/profile-issues-view.tsx @@ -279,10 +279,10 @@ export const ProfileIssuesView = () => { dragDisabled={groupByProperty !== "priority"} emptyState={{ title: router.pathname.includes("assigned") - ? `Issues assigned to ${profileData?.user_data.first_name} ${profileData?.user_data.last_name} will appear here` + ? `Issues assigned to ${profileData?.user_data.display_name} will appear here` : router.pathname.includes("created") - ? `Issues created by ${profileData?.user_data.first_name} ${profileData?.user_data.last_name} will appear here` - : `Issues subscribed by ${profileData?.user_data.first_name} ${profileData?.user_data.last_name} will appear here`, + ? `Issues created by ${profileData?.user_data.display_name} will appear here` + : `Issues subscribed by ${profileData?.user_data.display_name} will appear here`, }} handleOnDragEnd={handleOnDragEnd} handleIssueAction={handleIssueAction} diff --git a/apps/app/components/profile/sidebar.tsx b/apps/app/components/profile/sidebar.tsx index cb2fe1f5003..cf91b5150c7 100644 --- a/apps/app/components/profile/sidebar.tsx +++ b/apps/app/components/profile/sidebar.tsx @@ -86,29 +86,29 @@ export const ProfileSidebar = () => { userProjectsData.user_data.cover_image ?? "https://images.unsplash.com/photo-1506383796573-caf02b4a79ab" } - alt={userProjectsData.user_data.first_name} + alt={userProjectsData.user_data.display_name} className="h-32 w-full object-cover" />

{userProjectsData.user_data.avatar && userProjectsData.user_data.avatar !== "" ? ( {userProjectsData.user_data.first_name} ) : (
- {userProjectsData.user_data.first_name[0]} + {userProjectsData.user_data.display_name?.[0]}
)}
-

- {userProjectsData.user_data.first_name} {userProjectsData.user_data.last_name} -

-
{userProjectsData.user_data.email}
+

{userProjectsData.user_data.display_name}

+
+ {userProjectsData.user_data.display_name} +
{userDetails.map((detail) => ( diff --git a/apps/app/components/project/confirm-project-member-remove.tsx b/apps/app/components/project/confirm-project-member-remove.tsx index c6a0538a09a..bfce430a71a 100644 --- a/apps/app/components/project/confirm-project-member-remove.tsx +++ b/apps/app/components/project/confirm-project-member-remove.tsx @@ -67,13 +67,13 @@ const ConfirmProjectMemberRemove: React.FC = ({ isOpen, onClose, data, ha as="h3" className="text-lg font-medium leading-6 text-custom-text-100" > - Remove {data?.email}? + Remove {data?.display_name}?

Are you sure you want to remove member-{" "} - {data?.email}? They will no longer have - access to this project. This action cannot be undone. + {data?.display_name}? They will no + longer have access to this project. This action cannot be undone.

diff --git a/apps/app/components/project/create-project-modal.tsx b/apps/app/components/project/create-project-modal.tsx index 2b9c8bdc265..c48c8ec5563 100644 --- a/apps/app/components/project/create-project-modal.tsx +++ b/apps/app/components/project/create-project-modal.tsx @@ -163,20 +163,11 @@ export const CreateProjectModal: React.FC = ({ isOpen, setIsOpen, user }) const options = workspaceMembers?.map((member) => ({ value: member.member.id, - query: - (member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email) + - " " + - member.member.last_name ?? "", + query: member.member.display_name, content: (
- {`${ - member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email - } ${member.member.last_name ?? ""}`} + {member.member.display_name}
), })); @@ -376,10 +367,7 @@ export const CreateProjectModal: React.FC = ({ isOpen, setIsOpen, user }) {value ? ( <> - - {selectedMember?.member.first_name}{" "} - {selectedMember?.member.last_name} - + {selectedMember?.member.display_name} onChange(null)}> = ({ isOpen, setIsOpen, member }); const uninvitedPeople = people?.filter((person) => { - const isInvited = members?.find((member) => member.email === person.member.email); + const isInvited = members?.find((member) => member.display_name === person.member.display_name); return !isInvited; }); @@ -136,11 +136,11 @@ const SendProjectInvitationModal: React.FC = ({ isOpen, setIsOpen, member const options = uninvitedPeople?.map((person) => ({ value: person.member.id, - query: person.member.email, + query: person.member.display_name, content: (
- {person.member.email} + {person.member.display_name}
), })); @@ -209,7 +209,10 @@ const SendProjectInvitationModal: React.FC = ({ isOpen, setIsOpen, member people?.find((p) => p.member.id === value)?.member } /> - {people?.find((p) => p.member.id === value)?.member.email} + { + people?.find((p) => p.member.id === value)?.member + .display_name + }
) : (
Select co-worker’s email
diff --git a/apps/app/components/search-listbox/index.tsx b/apps/app/components/search-listbox/index.tsx index d563bcc6fac..bd60deaaba9 100644 --- a/apps/app/components/search-listbox/index.tsx +++ b/apps/app/components/search-listbox/index.tsx @@ -71,9 +71,7 @@ const SearchListbox: React.FC = ({ } else return (
- {user.member.first_name && user.member.first_name !== "" - ? user.member.first_name.charAt(0) - : user.member.email.charAt(0)} + {user.member.display_name.charAt(0)}
); }; diff --git a/apps/app/components/ui/avatar.tsx b/apps/app/components/ui/avatar.tsx index 8d476a9369e..cc68bc18bfd 100644 --- a/apps/app/components/ui/avatar.tsx +++ b/apps/app/components/ui/avatar.tsx @@ -47,7 +47,7 @@ export const Avatar: React.FC = ({ {user.first_name}
) : ( @@ -59,9 +59,7 @@ export const Avatar: React.FC = ({ fontSize: fontSize, }} > - {user?.first_name && user.first_name !== "" - ? user.first_name.charAt(0) - : user?.email?.charAt(0)} + {user?.display_name?.charAt(0)}
)}
diff --git a/apps/app/components/views/select-filters.tsx b/apps/app/components/views/select-filters.tsx index 2397a18a8a8..c621241cadf 100644 --- a/apps/app/components/views/select-filters.tsx +++ b/apps/app/components/views/select-filters.tsx @@ -127,9 +127,7 @@ export const SelectFilters: React.FC = ({ label: (
- {member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email} + {member.member.display_name}
), value: { @@ -149,9 +147,7 @@ export const SelectFilters: React.FC = ({ label: (
- {member.member.first_name && member.member.first_name !== "" - ? member.member.first_name - : member.member.email} + {member.member.display_name}
), value: { diff --git a/apps/app/components/workspace/confirm-workspace-member-remove.tsx b/apps/app/components/workspace/confirm-workspace-member-remove.tsx index 2f2cae6e47c..9a480c500e4 100644 --- a/apps/app/components/workspace/confirm-workspace-member-remove.tsx +++ b/apps/app/components/workspace/confirm-workspace-member-remove.tsx @@ -67,13 +67,13 @@ const ConfirmWorkspaceMemberRemove: React.FC = ({ isOpen, onClose, data, as="h3" className="text-lg font-medium leading-6 text-custom-text-100" > - Remove {data?.email}? + Remove {data?.display_name}?

Are you sure you want to remove member-{" "} - {data?.email}? They will no longer have - access to this workspace. This action cannot be undone. + {data?.display_name}? They will no + longer have access to this workspace. This action cannot be undone.

diff --git a/apps/app/components/workspace/sidebar-dropdown.tsx b/apps/app/components/workspace/sidebar-dropdown.tsx index 50328ecc353..e1c92282be4 100644 --- a/apps/app/components/workspace/sidebar-dropdown.tsx +++ b/apps/app/components/workspace/sidebar-dropdown.tsx @@ -149,7 +149,7 @@ export const WorkspaceSidebarDropdown = () => { border border-custom-sidebar-border-200 bg-custom-sidebar-background-90 shadow-lg outline-none" >
-
{user?.email}
+
{user?.display_name}
Workspace {workspaces ? (
diff --git a/apps/app/components/workspace/single-invitation.tsx b/apps/app/components/workspace/single-invitation.tsx index 833ac7ae83e..02b3d72b77e 100644 --- a/apps/app/components/workspace/single-invitation.tsx +++ b/apps/app/components/workspace/single-invitation.tsx @@ -41,8 +41,8 @@ const SingleInvitation: React.FC = ({

Invited by{" "} {invitation.created_by_detail - ? invitation.created_by_detail.first_name - : invitation.workspace.owner.first_name} + ? invitation.created_by_detail.display_name + : invitation.workspace.owner.display_name}

diff --git a/apps/app/constants/analytics.ts b/apps/app/constants/analytics.ts index 486a4e760ab..d152e211bc3 100644 --- a/apps/app/constants/analytics.ts +++ b/apps/app/constants/analytics.ts @@ -19,7 +19,7 @@ export const ANALYTICS_X_AXIS_VALUES: { value: TXAxisValues; label: string }[] = label: "Label", }, { - value: "assignees__email", + value: "assignees__id", label: "Assignee", }, { diff --git a/apps/app/constants/fetch-keys.ts b/apps/app/constants/fetch-keys.ts index ce69322057d..1b8c77120a8 100644 --- a/apps/app/constants/fetch-keys.ts +++ b/apps/app/constants/fetch-keys.ts @@ -69,9 +69,13 @@ export const WORKSPACE_DETAILS = (workspaceSlug: string) => export const WORKSPACE_MEMBERS = (workspaceSlug: string) => `WORKSPACE_MEMBERS_${workspaceSlug.toUpperCase()}`; +export const WORKSPACE_MEMBERS_WITH_EMAIL = (workspaceSlug: string) => + `WORKSPACE_MEMBERS_WITH_EMAIL_${workspaceSlug.toUpperCase()}`; export const WORKSPACE_MEMBERS_ME = (workspaceSlug: string) => `WORKSPACE_MEMBERS_ME${workspaceSlug.toUpperCase()}`; export const WORKSPACE_INVITATIONS = "WORKSPACE_INVITATIONS"; +export const WORKSPACE_INVITATION_WITH_EMAIL = (workspaceSlug: string) => + `WORKSPACE_INVITATION_WITH_EMAIL_${workspaceSlug.toUpperCase()}`; export const WORKSPACE_INVITATION = "WORKSPACE_INVITATION"; export const LAST_ACTIVE_WORKSPACE_AND_PROJECTS = "LAST_ACTIVE_WORKSPACE_AND_PROJECTS"; @@ -90,7 +94,11 @@ export const PROJECTS_LIST = ( export const PROJECT_DETAILS = (projectId: string) => `PROJECT_DETAILS_${projectId.toUpperCase()}`; export const PROJECT_MEMBERS = (projectId: string) => `PROJECT_MEMBERS_${projectId.toUpperCase()}`; +export const PROJECT_MEMBERS_WITH_EMAIL = (workspaceSlug: string, projectId: string) => + `PROJECT_MEMBERS_WITH_EMAIL_${workspaceSlug}_${projectId.toUpperCase()}`; export const PROJECT_INVITATIONS = "PROJECT_INVITATIONS"; +export const PROJECT_INVITATIONS_WITH_EMAIL = (workspaceSlug: string, projectId: string) => + `PROJECT_INVITATIONS_WITH_EMAIL_${workspaceSlug}_${projectId.toUpperCase()}`; export const PROJECT_ISSUES_LIST = (workspaceSlug: string, projectId: string) => `PROJECT_ISSUES_LIST_${workspaceSlug.toUpperCase()}_${projectId.toUpperCase()}`; diff --git a/apps/app/constants/spreadsheet.ts b/apps/app/constants/spreadsheet.ts index 371fb50a318..0dcab72208e 100644 --- a/apps/app/constants/spreadsheet.ts +++ b/apps/app/constants/spreadsheet.ts @@ -32,8 +32,8 @@ export const SPREADSHEET_COLUMN = [ colName: "Assignees", colSize: "128px", icon: UserGroupIcon, - ascendingOrder: "assignees__first_name", - descendingOrder: "-assignees__first_name", + ascendingOrder: "assignees__id", + descendingOrder: "-assignees__id", }, { propertyName: "labels", diff --git a/apps/app/pages/[workspaceSlug]/me/profile/activity.tsx b/apps/app/pages/[workspaceSlug]/me/profile/activity.tsx index 1b0dc005d14..1b04388e64f 100644 --- a/apps/app/pages/[workspaceSlug]/me/profile/activity.tsx +++ b/apps/app/pages/[workspaceSlug]/me/profile/activity.tsx @@ -73,7 +73,7 @@ const ProfileActivity = () => { activityItem.actor_detail.avatar !== "" ? ( {activityItem.actor_detail.first_name} {
- {activityItem.actor_detail.first_name.charAt(0)} + {activityItem.actor_detail.display_name?.charAt(0)}
)} @@ -96,10 +96,9 @@ const ProfileActivity = () => {
- {activityItem.actor_detail.first_name} {activityItem.actor_detail.is_bot - ? "Bot" - : " " + activityItem.actor_detail.last_name} + ? activityItem.actor_detail.first_name + " Bot" + : activityItem.actor_detail.display_name}

Commented {timeAgo(activityItem.created_at)} @@ -176,7 +175,7 @@ const ProfileActivity = () => { activityItem.actor_detail.avatar !== "" ? ( {activityItem.actor_detail.first_name} {

- {activityItem.actor_detail.first_name.charAt(0)} + {activityItem.actor_detail.display_name?.charAt(0)}
)}
@@ -206,8 +205,7 @@ const ProfileActivity = () => { href={`/${workspaceSlug}/profile/${activityItem.actor_detail.id}`} > - {activityItem.actor_detail.first_name}{" "} - {activityItem.actor_detail.last_name} + {activityItem.actor_detail.display_name} )}{" "} diff --git a/apps/app/pages/[workspaceSlug]/me/profile/index.tsx b/apps/app/pages/[workspaceSlug]/me/profile/index.tsx index 3fb73c40ddd..2ae98492159 100644 --- a/apps/app/pages/[workspaceSlug]/me/profile/index.tsx +++ b/apps/app/pages/[workspaceSlug]/me/profile/index.tsx @@ -176,7 +176,7 @@ const Profile: NextPage = () => { src={watch("avatar")} className="absolute top-0 left-0 h-full w-full object-cover rounded-md" onClick={() => setIsImageUploadModalOpen(true)} - alt={myProfile.first_name} + alt={myProfile.display_name} />
)} diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/control.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/control.tsx index 9e8d437e8af..12ef350aade 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/control.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/control.tsx @@ -131,7 +131,7 @@ const ControlSettings: NextPage = () => { {...field} label={ people?.find((person) => person.member.id === field.value)?.member - .first_name ?? Select lead + .display_name ?? Select lead } width="w-full" input @@ -153,14 +153,10 @@ const ControlSettings: NextPage = () => {
) : (
- {person.member.first_name && person.member.first_name !== "" - ? person.member.first_name.charAt(0) - : person.member.email.charAt(0)} + {person.member.display_name?.charAt(0)}
)} - {person.member.first_name !== "" - ? person.member.first_name - : person.member.email} + {person.member.display_name}
))} @@ -190,7 +186,7 @@ const ControlSettings: NextPage = () => { p.member.id === field.value)?.member.first_name ?? ( + people?.find((p) => p.member.id === field.value)?.member.display_name ?? ( Select default assignee ) } @@ -214,14 +210,10 @@ const ControlSettings: NextPage = () => { ) : (
- {person.member.first_name && person.member.first_name !== "" - ? person.member.first_name.charAt(0) - : person.member.email.charAt(0)} + {person.member.display_name?.charAt(0)}
)} - {person.member.first_name !== "" - ? person.member.first_name - : person.member.email} + {person.member.display_name} ))} diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx index d828b3912ba..88301cc6157 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx @@ -26,7 +26,11 @@ import { PlusIcon, XMarkIcon } from "@heroicons/react/24/outline"; // types import type { NextPage } from "next"; // fetch-keys -import { PROJECT_INVITATIONS, PROJECT_MEMBERS, WORKSPACE_DETAILS } from "constants/fetch-keys"; +import { + PROJECT_INVITATIONS_WITH_EMAIL, + PROJECT_MEMBERS_WITH_EMAIL, + WORKSPACE_DETAILS, +} from "constants/fetch-keys"; // constants import { ROLE } from "constants/workspace"; // helper @@ -51,16 +55,21 @@ const MembersSettings: NextPage = () => { ); const { data: projectMembers, mutate: mutateMembers } = useSWR( - workspaceSlug && projectId ? PROJECT_MEMBERS(projectId as string) : null, workspaceSlug && projectId - ? () => projectService.projectMembers(workspaceSlug as string, projectId as string) + ? PROJECT_MEMBERS_WITH_EMAIL(workspaceSlug.toString(), projectId.toString()) + : null, + workspaceSlug && projectId + ? () => projectService.projectMembersWithEmail(workspaceSlug as string, projectId as string) : null ); const { data: projectInvitations, mutate: mutateInvitations } = useSWR( - workspaceSlug && projectId ? PROJECT_INVITATIONS : null, workspaceSlug && projectId - ? () => projectService.projectInvitations(workspaceSlug as string, projectId as string) + ? PROJECT_INVITATIONS_WITH_EMAIL(workspaceSlug.toString(), projectId.toString()) + : null, + workspaceSlug && projectId + ? () => + projectService.projectInvitationsWithEmail(workspaceSlug as string, projectId as string) : null ); @@ -71,7 +80,7 @@ const MembersSettings: NextPage = () => { avatar: item.member?.avatar, first_name: item.member?.first_name, last_name: item.member?.last_name, - email: item.member?.email, + display_name: item.member?.display_name, role: item.role, status: true, member: true, @@ -82,7 +91,7 @@ const MembersSettings: NextPage = () => { avatar: item.avatar ?? "", first_name: item.first_name ?? item.email, last_name: item.last_name ?? "", - email: item.email, + display_name: item.email, role: item.role, status: item.accepted, member: false, @@ -181,28 +190,24 @@ const MembersSettings: NextPage = () => { {member.avatar && member.avatar !== "" ? ( {member.first_name} - ) : member.first_name !== "" ? ( - member.first_name.charAt(0) ) : ( - member.email.charAt(0) + member.display_name.charAt(0) )}
{member.member ? ( - - {member.first_name} {member.last_name} - + {member.display_name} ) : ( -

- {member.first_name} {member.last_name} -

+

{member.display_name}

)} -

{member.email}

+

+ {member.display_name} +

diff --git a/apps/app/pages/[workspaceSlug]/settings/members.tsx b/apps/app/pages/[workspaceSlug]/settings/members.tsx index 0fc2d5fd9b8..b348d5f7f66 100644 --- a/apps/app/pages/[workspaceSlug]/settings/members.tsx +++ b/apps/app/pages/[workspaceSlug]/settings/members.tsx @@ -24,7 +24,11 @@ import { PlusIcon } from "@heroicons/react/24/outline"; // types import type { NextPage } from "next"; // fetch-keys -import { WORKSPACE_DETAILS, WORKSPACE_INVITATIONS, WORKSPACE_MEMBERS } from "constants/fetch-keys"; +import { + WORKSPACE_DETAILS, + WORKSPACE_INVITATION_WITH_EMAIL, + WORKSPACE_MEMBERS_WITH_EMAIL, +} from "constants/fetch-keys"; // constants import { ROLE } from "constants/workspace"; // helper @@ -48,13 +52,17 @@ const MembersSettings: NextPage = () => { ); const { data: workspaceMembers, mutate: mutateMembers } = useSWR( - workspaceSlug ? WORKSPACE_MEMBERS(workspaceSlug.toString()) : null, - workspaceSlug ? () => workspaceService.workspaceMembers(workspaceSlug.toString()) : null + workspaceSlug ? WORKSPACE_MEMBERS_WITH_EMAIL(workspaceSlug.toString()) : null, + workspaceSlug + ? () => workspaceService.workspaceMembersWithEmail(workspaceSlug.toString()) + : null ); const { data: workspaceInvitations, mutate: mutateInvitations } = useSWR( - workspaceSlug ? WORKSPACE_INVITATIONS : null, - workspaceSlug ? () => workspaceService.workspaceInvitations(workspaceSlug.toString()) : null + workspaceSlug ? WORKSPACE_INVITATION_WITH_EMAIL(workspaceSlug.toString()) : null, + workspaceSlug + ? () => workspaceService.workspaceInvitationsWithEmail(workspaceSlug.toString()) + : null ); const members = [ @@ -65,6 +73,7 @@ const MembersSettings: NextPage = () => { first_name: item.member?.first_name, last_name: item.member?.last_name, email: item.member?.email, + display_name: item.member?.display_name, role: item.role, status: true, member: true, @@ -77,6 +86,7 @@ const MembersSettings: NextPage = () => { first_name: item.email, last_name: "", email: item.email, + display_name: item.email, role: item.role, status: item.accepted, member: false, @@ -199,27 +209,23 @@ const MembersSettings: NextPage = () => { {member.first_name} - ) : member.first_name !== "" ? ( - member.first_name.charAt(0) ) : ( - member.email.charAt(0) + (member.display_name || member.email).charAt(0) )}
{member.member ? ( - - {member.first_name} {member.last_name} - + {member.display_name || member.email} ) : ( -

- {member.first_name} {member.last_name} -

+

{member.display_name}

)} -

{member.email}

+

+ {member.display_name || member.email} +

diff --git a/apps/app/pages/api/track-event.ts b/apps/app/pages/api/track-event.ts index c362f68fdee..d6158cf9ab2 100644 --- a/apps/app/pages/api/track-event.ts +++ b/apps/app/pages/api/track-event.ts @@ -26,6 +26,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) email: user.email, first_name: user.first_name, last_name: user.last_name, + display_name: user?.display_name, }) .then(() => { jitsu.track(eventName, { diff --git a/apps/app/services/project.service.ts b/apps/app/services/project.service.ts index d25bcd9a66d..961333bee57 100644 --- a/apps/app/services/project.service.ts +++ b/apps/app/services/project.service.ts @@ -151,6 +151,17 @@ class ProjectServices extends APIService { } async projectMembers(workspaceSlug: string, projectId: string): Promise { + return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/project-members/`) + .then((response) => response?.data) + .catch((error) => { + throw error?.response?.data; + }); + } + + async projectMembersWithEmail( + workspaceSlug: string, + projectId: string + ): Promise { return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/members/`) .then((response) => response?.data) .catch((error) => { @@ -219,6 +230,17 @@ class ProjectServices extends APIService { }); } + async projectInvitationsWithEmail( + workspaceSlug: string, + projectId: string + ): Promise { + return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/invitations/`) + .then((response) => response?.data) + .catch((error) => { + throw error?.response?.data; + }); + } + async updateProjectInvitation( workspaceSlug: string, projectId: string, diff --git a/apps/app/services/workspace.service.ts b/apps/app/services/workspace.service.ts index c9824c26a60..8097253e634 100644 --- a/apps/app/services/workspace.service.ts +++ b/apps/app/services/workspace.service.ts @@ -155,6 +155,14 @@ class WorkspaceService extends APIService { } async workspaceMembers(workspaceSlug: string): Promise { + return this.get(`/api/workspaces/${workspaceSlug}/workspace-members/`) + .then((response) => response?.data) + .catch((error) => { + throw error?.response?.data; + }); + } + + async workspaceMembersWithEmail(workspaceSlug: string): Promise { return this.get(`/api/workspaces/${workspaceSlug}/members/`) .then((response) => response?.data) .catch((error) => { @@ -209,6 +217,16 @@ class WorkspaceService extends APIService { }); } + async workspaceInvitationsWithEmail( + workspaceSlug: string + ): Promise { + return this.get(`/api/workspaces/${workspaceSlug}/invitations/`) + .then((response) => response?.data) + .catch((error) => { + throw error?.response?.data; + }); + } + async getWorkspaceInvitation(invitationId: string): Promise { return this.get(`/api/users/me/invitations/${invitationId}/`, { headers: {} }) .then((response) => response?.data) diff --git a/apps/app/types/analytics.d.ts b/apps/app/types/analytics.d.ts index 67bc0cd10e7..34310a631b4 100644 --- a/apps/app/types/analytics.d.ts +++ b/apps/app/types/analytics.d.ts @@ -4,8 +4,8 @@ export interface IAnalyticsResponse { extras: { colors: IAnalyticsExtra[]; assignee_details: { + assignees__display_name: string | null; assignees__avatar: string | null; - assignees__email: string; assignees__first_name: string; assignees__last_name: string; }[]; @@ -30,7 +30,7 @@ export type TXAxisValues = | "state__name" | "state__group" | "labels__name" - | "assignees__email" + | "assignees__id" | "estimate_point" | "issue_cycle__cycle__name" | "issue_module__module__name" @@ -65,9 +65,9 @@ export interface IExportAnalyticsFormData { export interface IDefaultAnalyticsUser { assignees__avatar: string | null; - assignees__email: string | null; assignees__first_name: string; assignees__last_name: string; + assignees__display_name: string; count: number; } @@ -76,9 +76,9 @@ export interface IDefaultAnalyticsResponse { most_issue_closed_user: IDefaultAnalyticsUser[]; most_issue_created_user: { created_by__avatar: string | null; - created_by__email: string | null; created_by__first_name: string; created_by__last_name: string; + created_by__display_name: string; count: number; }[]; open_estimate_sum: number; diff --git a/apps/app/types/cycles.d.ts b/apps/app/types/cycles.d.ts index 878e9c060e6..df358b7a983 100644 --- a/apps/app/types/cycles.d.ts +++ b/apps/app/types/cycles.d.ts @@ -49,6 +49,7 @@ export type TAssigneesDistribution = { completed_issues: number; first_name: string | null; last_name: string | null; + display_name: string | null; pending_issues: number; total_issues: number; }; diff --git a/apps/app/types/projects.d.ts b/apps/app/types/projects.d.ts index 2274e3d2254..df71adb31af 100644 --- a/apps/app/types/projects.d.ts +++ b/apps/app/types/projects.d.ts @@ -3,6 +3,7 @@ import type { IUserLite, IWorkspace, IWorkspaceLite, + IUserMemberLite, TIssueGroupByOptions, TIssueOrderByOptions, TIssueViewOptions, @@ -78,7 +79,7 @@ type ProjectPreferences = { export interface IProjectMember { id: string; - member: IUserLite; + member: IUserMemberLite; project: IProjectLite; workspace: IWorkspaceLite; comment: string; diff --git a/apps/app/types/users.d.ts b/apps/app/types/users.d.ts index 5b174cc5abc..68f0b0c78a4 100644 --- a/apps/app/types/users.d.ts +++ b/apps/app/types/users.d.ts @@ -15,6 +15,7 @@ export interface IUser { created_location: readonly string; date_joined: readonly Date; email: string; + display_name: string; first_name: string; id: readonly string; is_email_verified: boolean; @@ -53,13 +54,17 @@ export interface ICurrentUserResponse extends IUser { export interface IUserLite { avatar: string; created_at: Date; - email: string; + display_name: string; first_name: string; readonly id: string; is_bot: boolean; last_name: string; } +export interface IUserMemberLite extends IUserLite { + email: string; +} + export interface IUserActivity { created_date: string; activity_count: number; @@ -141,7 +146,7 @@ export interface IUserProfileProjectSegregation { avatar: string; cover_image: string | null; date_joined: Date; - email: string; + display_name: string; first_name: string; last_name: string; user_timezone: string; diff --git a/apps/app/types/workspace.d.ts b/apps/app/types/workspace.d.ts index 5546a680cf5..c26ce53625e 100644 --- a/apps/app/types/workspace.d.ts +++ b/apps/app/types/workspace.d.ts @@ -2,7 +2,7 @@ import type { IIssueFilterOptions, IProjectMember, IUser, - IUserLite, + IUserMemberLite, TIssueGroupByOptions, TIssueOrderByOptions, TIssueViewOptions, @@ -73,9 +73,8 @@ export interface IWorkspaceViewProps { export interface IWorkspaceMember { readonly id: string; - user: IUserLite; workspace: IWorkspace; - member: IUserLite; + member: IUserMemberLite; role: 5 | 10 | 15 | 20; company_role: string | null; view_props: IWorkspaceViewProps;