Skip to content

Commit

Permalink
Handle empty commit messages (#7767)
Browse files Browse the repository at this point in the history
* Handle empty commit messages

* Simplify condition
  • Loading branch information
itaigilo committed May 19, 2024
1 parent dc98f49 commit c33a166
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion webui/src/lib/components/repository/commits.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,16 @@ const CommitInfo = ({ repo, commit }) => {
);
};

export const CommitMessage = ({ commit }) =>
commit.message?.length ?
<span>{commit.message}</span> : <span className="text-muted">(No commit message)</span>;

export const CommitInfoCard = ({ repo, commit, bare = false }) => {
const content = (
<>
<div className="d-flex">
<div className="flex-grow-1">
<h4>{commit.message}</h4>
<h4><CommitMessage commit={commit}/></h4>
</div>
<div>
<CommitActions repo={repo} commit={commit}/>
Expand Down
3 changes: 2 additions & 1 deletion webui/src/pages/repositories/repository/commits/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
LinkButton,
Loading, RefreshButton
} from "../../../../lib/components/controls";
import {CommitMessage} from "../../../../lib/components/repository/commits";
import {useRefs} from "../../../../lib/hooks/repo";
import {useAPIWithPagination} from "../../../../lib/hooks/api";
import {Paginator} from "../../../../lib/components/pagination";
Expand All @@ -38,7 +39,7 @@ const CommitWidget = ({ repo, commit }) => {
pathname: '/repositories/:repoId/commits/:commitId',
params: {repoId: repo.id, commitId: commit.id}
}}>
{commit.message}
<CommitMessage commit={commit}/>
</Link>
</h6>
<p>
Expand Down

0 comments on commit c33a166

Please sign in to comment.