Skip to content

Commit

Permalink
change getCommitNumber()
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewnt219 committed Oct 21, 2021
1 parent 5b98030 commit cc856ab
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/web/src/components/Posts/Commits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const useStyles = makeStyles((theme: Theme) =>
})
);

const getCommitNumber = (url: string) => url.replace(/.+\/(commit|commits)\/(\w{40}).*/, '$2');
const getCommitNumber = (url: string, length?: number) =>
url.replace(/.+\/(commit|commits)\/(\w{40}).*/, '$2').substr(0, length);

type Props = {
commitUrls: string[];
Expand All @@ -56,10 +57,10 @@ const Commits = ({ commitUrls }: Props) => {
href={`https://github.com${url}`}
rel="bookmark"
target="_blank"
title={'Commit #' + getCommitNumber(url)}
title={'Commit' + getCommitNumber(url)}
className={classes.link}
>
#{getCommitNumber(url).substr(0, 6)}
{getCommitNumber(url, 6)}
</a>
</p>
))}
Expand Down

0 comments on commit cc856ab

Please sign in to comment.