From a8066090f0b331961ea29a2eb7d95c627af36faa Mon Sep 17 00:00:00 2001 From: raghavaggarwal2308 Date: Wed, 27 Sep 2023 15:56:08 +0530 Subject: [PATCH 1/4] [MI-3567] Fix UX for member_access_request in right hand sidebar --- webapp/src/components/sidebar_right/gitlab_items.tsx | 12 +++++------- webapp/src/types/gitlab_items.ts | 3 +++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/webapp/src/components/sidebar_right/gitlab_items.tsx b/webapp/src/components/sidebar_right/gitlab_items.tsx index a3842c82d..ec1bbc321 100644 --- a/webapp/src/components/sidebar_right/gitlab_items.tsx +++ b/webapp/src/components/sidebar_right/gitlab_items.tsx @@ -20,12 +20,13 @@ export const notificationReasons: Record = { approval_required: 'Your approval is required on this issue/merge request.', unmergeable: 'This merge request can\'t be merged.', merge_train_removed: 'A merge train was removed.', + member_access_requested: 'reqested access to a project/group.' }; const SUCCESS = 'success'; const PENDING = 'pending'; -function GitlabItems({item, theme}: GitlabItemsProps) { +function GitlabItems({item, theme}: GitlabItemsProps) { const style = getStyle(theme); const repoName = item.references?.full || item.project?.path_with_namespace || ''; @@ -48,7 +49,7 @@ function GitlabItems({item, theme}: GitlabItemsProps) { ); } - const titleText = item.title || item.target?.title || ''; + const titleText = item.title || item.target?.title || item.body || ''; let title: React.ReactNode = titleText; if (item.web_url || item.target_url) { @@ -174,17 +175,14 @@ function GitlabItems({item, theme}: GitlabItemsProps) {
{number} - {repoName} + {repoName && ({repoName})}
{labels}
- {'Opened'} {item.created_at && ` ${formatTimeSince(item.created_at)} ago`} - {userName && ` by ${userName}`} - {'.'} {milestone}
{item.updated_at && `Updated ${formatTimeSince(item.updated_at)} ago.`}
- {notificationReasons[item.action_name]} + {item.action_name=='member_access_requested' && {item.author.name}} {notificationReasons[item.action_name]} )}
diff --git a/webapp/src/types/gitlab_items.ts b/webapp/src/types/gitlab_items.ts index 572353982..69579dea5 100644 --- a/webapp/src/types/gitlab_items.ts +++ b/webapp/src/types/gitlab_items.ts @@ -11,6 +11,8 @@ export interface Label { export interface User { username: string; + web_url: string; + name: string; } export interface References { @@ -57,6 +59,7 @@ export interface Item { num_approvers: number; total_reviewers: number; reviewers: User[]; + body: string; } export interface GitlabItemsProps { From c9e8eb1515680002d48483f3e99a2ceddd4228ef Mon Sep 17 00:00:00 2001 From: raghavaggarwal2308 Date: Thu, 5 Oct 2023 16:22:59 +0530 Subject: [PATCH 2/4] [MI-3567] Review fixes --- webapp/src/components/sidebar_right/gitlab_items.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/webapp/src/components/sidebar_right/gitlab_items.tsx b/webapp/src/components/sidebar_right/gitlab_items.tsx index ec1bbc321..b30179153 100644 --- a/webapp/src/components/sidebar_right/gitlab_items.tsx +++ b/webapp/src/components/sidebar_right/gitlab_items.tsx @@ -20,13 +20,14 @@ export const notificationReasons: Record = { approval_required: 'Your approval is required on this issue/merge request.', unmergeable: 'This merge request can\'t be merged.', merge_train_removed: 'A merge train was removed.', - member_access_requested: 'reqested access to a project/group.' + member_access_requested: 'requested access to a project/group.' }; const SUCCESS = 'success'; const PENDING = 'pending'; +const ActionNameMemberAccessRequested = 'member_access_requested' -function GitlabItems({item, theme}: GitlabItemsProps) { +function GitlabItems({item, theme}: GitlabItemsProps) { const style = getStyle(theme); const repoName = item.references?.full || item.project?.path_with_namespace || ''; @@ -192,7 +193,7 @@ function GitlabItems({item, theme}: GitlabItemsProps) { {item.action_name && ( <>
{item.updated_at && `Updated ${formatTimeSince(item.updated_at)} ago.`}
- {item.action_name=='member_access_requested' && {item.author.name}} {notificationReasons[item.action_name]} + {item.action_name==ActionNameMemberAccessRequested && {item.author.name}} {notificationReasons[item.action_name]} )} From 2d2831a6f5d9474dc5100a5a7a0a0ccb4bec4216 Mon Sep 17 00:00:00 2001 From: raghavaggarwal2308 Date: Thu, 5 Oct 2023 16:24:44 +0530 Subject: [PATCH 3/4] [MI-3567] Added a semicolon --- webapp/src/components/sidebar_right/gitlab_items.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/components/sidebar_right/gitlab_items.tsx b/webapp/src/components/sidebar_right/gitlab_items.tsx index b30179153..db3371c84 100644 --- a/webapp/src/components/sidebar_right/gitlab_items.tsx +++ b/webapp/src/components/sidebar_right/gitlab_items.tsx @@ -25,7 +25,7 @@ export const notificationReasons: Record = { const SUCCESS = 'success'; const PENDING = 'pending'; -const ActionNameMemberAccessRequested = 'member_access_requested' +const ActionNameMemberAccessRequested = 'member_access_requested'; function GitlabItems({item, theme}: GitlabItemsProps) { const style = getStyle(theme); From 1ddc409e54b827c064b79a32cb1522ba91c04a1a Mon Sep 17 00:00:00 2001 From: raghavaggarwal2308 Date: Thu, 5 Oct 2023 16:40:36 +0530 Subject: [PATCH 4/4] [MI-3567] Review fixes --- webapp/src/components/sidebar_right/gitlab_items.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/src/components/sidebar_right/gitlab_items.tsx b/webapp/src/components/sidebar_right/gitlab_items.tsx index db3371c84..d4092f233 100644 --- a/webapp/src/components/sidebar_right/gitlab_items.tsx +++ b/webapp/src/components/sidebar_right/gitlab_items.tsx @@ -25,7 +25,7 @@ export const notificationReasons: Record = { const SUCCESS = 'success'; const PENDING = 'pending'; -const ActionNameMemberAccessRequested = 'member_access_requested'; +const ACTION_NAME_MEMBER_ACCESS_REQUESTED = 'member_access_requested'; function GitlabItems({item, theme}: GitlabItemsProps) { const style = getStyle(theme); @@ -193,7 +193,7 @@ function GitlabItems({item, theme}: GitlabItemsProps) { {item.action_name && ( <>
{item.updated_at && `Updated ${formatTimeSince(item.updated_at)} ago.`}
- {item.action_name==ActionNameMemberAccessRequested && {item.author.name}} {notificationReasons[item.action_name]} + {item.action_name == ACTION_NAME_MEMBER_ACCESS_REQUESTED && {item.author.name}} {notificationReasons[item.action_name]} )}