Skip to content

Commit

Permalink
fix: [code-1991]: hide ssh and add optional chaining to filter functi…
Browse files Browse the repository at this point in the history
…on (#2100)
  • Loading branch information
cjlee01 authored and Harness committed Jun 12, 2024
1 parent f0e12fa commit 45acf04
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions web/src/components/CloneButtonTooltip/CloneButtonTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function CloneButtonTooltip({ httpsURL, sshURL }: CloneButtonTooltipProps
<Container padding={{ top: 'small' }}>
{
// TODO: replace with data from config api
sshURL && <Text font={{ variation: FontVariation.BODY2_SEMI }}>HTTP</Text>
sshURL && <Text font={{ variation: FontVariation.BODY2_SEMI }}>{getString('http')}</Text>
}
<Layout.Horizontal className={css.layout}>
<Text className={css.url}>{httpsURL}</Text>
Expand All @@ -68,7 +68,7 @@ export function CloneButtonTooltip({ httpsURL, sshURL }: CloneButtonTooltipProps
// TODO: replace with data from config api
sshURL && (
<Container padding={{ top: 'small' }}>
<Text font={{ variation: FontVariation.BODY2_SEMI }}>SSH</Text>
<Text font={{ variation: FontVariation.BODY2_SEMI }}>{getString('ssh')}</Text>
<Layout.Horizontal className={css.layout}>
<Text className={css.url}>{sshURL}</Text>

Expand Down
2 changes: 2 additions & 0 deletions web/src/framework/strings/stringTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ export interface StringsMap {
'homepage.selectSpaceContent': string
'homepage.selectSpaceTitle': string
'homepage.welcomeText': string
http: string
'imageUpload.readyToUpload': string
'imageUpload.text': string
'imageUpload.title': string
Expand Down Expand Up @@ -966,6 +967,7 @@ export interface StringsMap {
spaceUpdate: string
spaces: string
squashMerge: string
ssh: string
sslVerificationLabel: string
startSearching: string
status: string
Expand Down
2 changes: 2 additions & 0 deletions web/src/i18n/strings.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1179,3 +1179,5 @@ confirmStrat: 'Confirm {{strat}}'
waiting: Waiting
changesRequestedBy: CHANGES REQUESTED BY
mergeBranchTitle: Merge branch {{branchName}} of {{repoPath}} (#{{prNum}})
http: HTTP
ssh: SSH
12 changes: 6 additions & 6 deletions web/src/pages/PullRequest/Conversation/Conversation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,22 @@ export const Conversation: React.FC<ConversationProps> = ({

switch (activityFilter.value) {
case PRCommentFilterType.ALL_COMMENTS:
return blocks.filter(_activities => !isSystemComment(_activities))
return blocks?.filter(_activities => !isSystemComment(_activities))

case PRCommentFilterType.RESOLVED_COMMENTS:
return blocks.filter(
return blocks?.filter(
_activities => _activities[0].payload?.resolved && (isCodeComment(_activities) || isComment(_activities))
)

case PRCommentFilterType.UNRESOLVED_COMMENTS:
return blocks.filter(
return blocks?.filter(
_activities => !_activities[0].payload?.resolved && (isComment(_activities) || isCodeComment(_activities))
)

case PRCommentFilterType.MY_COMMENTS: {
const allCommentBlock = blocks.filter(_activities => !isSystemComment(_activities))
const userCommentsOnly = allCommentBlock.filter(_activities => {
const userCommentReply = _activities.filter(
const allCommentBlock = blocks?.filter(_activities => !isSystemComment(_activities))
const userCommentsOnly = allCommentBlock?.filter(_activities => {
const userCommentReply = _activities?.filter(
authorIsUser => currentUser?.uid && authorIsUser.payload?.author?.uid === currentUser?.uid
)
return userCommentReply.length !== 0
Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/Repository/EmptyRepositoryInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const EmptyRepositoryInfo: React.FC<Pick<GitInfoProps, 'repoMetadata'>> =
<Container padding={{ bottom: 'medium' }} width={400} margin={{ right: 'small' }}>
{
// TODO: replace with data from config api
repoMetadata.git_ssh_url && <Text>HTTP</Text>
repoMetadata.git_ssh_url && <Text>{getString('http')}</Text>
}
<Layout.Horizontal className={css.layout}>
<Text className={css.url}>{repoMetadata.git_url}</Text>
Expand All @@ -114,7 +114,7 @@ export const EmptyRepositoryInfo: React.FC<Pick<GitInfoProps, 'repoMetadata'>> =
// TODO: replace with data from config api
repoMetadata.git_ssh_url && (
<>
<Text>SSH</Text>
<Text>{getString('ssh')}</Text>
<Layout.Horizontal className={css.layout}>
<Text className={css.url}>{repoMetadata.git_ssh_url}</Text>
<FlexExpander />
Expand Down

0 comments on commit 45acf04

Please sign in to comment.