feat: [code-763]: fix html encode issue (#333)

This commit is contained in:
Calvin Lee 2023-08-17 21:50:13 +00:00 committed by Harness
parent 7dd8c1d276
commit 69730994d8
2 changed files with 14 additions and 9 deletions

View File

@ -185,7 +185,7 @@ editNotAllowed: You must be on a branch to edit this file
newFileNotAllowed: You must be on a branch to create a new file
fileDeleted: '__path__ successfully deleted.'
newPullRequest: New Pull Request
pullRequestEmpty: Here is no Pull Request. Try to
pullRequestEmpty: There are no pull requests in your project. Click the button below to create a pull request.
comparingChanges: Comparing Changes
selectToViewMore: Select branch to view more here.
createPullRequest: Create pull request
@ -388,7 +388,7 @@ repoEmptyMarkdownExisting: |
```
You might need [to create an API token](CREATE_API_TOKEN_URL) in order to pull from or push into this repository.
webhookEmpty: Here is no WebHooks. Try to
webhookEmpty: There are no webhooks in your project. Click the button below to create a webhook.
compareEmptyDiffTitle: There isn't anything to compare
compareEmptyDiffMessage: Two branches are identical.
noCommits: There is no commits
@ -475,15 +475,15 @@ creationDate: Creation Date
viewFiles: View Files
tagger: Tagger
confirmDelete: Confirm delete
tagEmpty: Here is no Tag. Try to
tagEmpty: There are no tags in your project. Click the button below to create a tag.
newTag: New Tag
overview: Overview
fileTooLarge: File is too large to open. {download}
clickHereToDownload: Click here to download.
viewFile: View the file at this point in the history
viewRepo: View the repository at this point in the history
hideCommitHistory: Renamed from {{file}} - Hide History
showCommitHistory: Renamed from {{file}} - Show History
hideCommitHistory: Renamed from {file} - Hide History
showCommitHistory: Renamed from {file} - Show History
noReviewers: No Reviewers
assignPeople: Assign people
add: Add +

View File

@ -1,5 +1,5 @@
import React, { useState } from 'react'
import { Icon, Text } from '@harness/uicore'
import { Icon, Text, StringSubstitute } from '@harness/uicore'
import { useGet } from 'restful-react'
import cx from 'classnames'
import { ThreadSection } from 'components/ThreadSection/ThreadSection'
@ -55,6 +55,9 @@ const SingleFileRenameHistory = (props: {
const commitsData = commits?.commits
const showCommitHistory = isFileShown && commitsData && commitsData.length > 0
const vars = {
file: details.old_path
}
return (
<ThreadSection
hideGutter
@ -62,9 +65,11 @@ const SingleFileRenameHistory = (props: {
contentClassName={css.contentSection}
title={
<Text padding={{ top: 'large' }} className={cx(css.hideText, css.lineDiv)} onClick={toggleCommitHistory}>
{showCommitHistory
? getString('hideCommitHistory', { file: details.old_path })
: getString('showCommitHistory', { file: details.old_path })}
<StringSubstitute
str={showCommitHistory ? getString('hideCommitHistory') : getString('showCommitHistory')}
vars={vars}
/>
{showCommitHistory ? (
<Icon padding={'xsmall'} name={'main-chevron-up'} size={8}></Icon>
) : (