Skip to content

Commit

Permalink
🐛 Add a fallback for issue title
Browse files Browse the repository at this point in the history
Signed-off-by: ibolton336 <[email protected]>
  • Loading branch information
ibolton336 committed Aug 9, 2023
1 parent 5e9a715 commit 119e8c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion client/src/app/pages/issues/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,17 @@ export const getAffectedAppsUrl = ({
.replace("/:rule/", `/${encodeURIComponent(ruleReport.rule)}/`);
const prefix = (key: string) =>
`${TableURLParamKeyPrefix.issuesAffectedApps}:${key}`;

const issueTitle =
ruleReport.description.split("\n")[0] ||
ruleReport.name.split("\n")[0] ||
"Issue name";

return `${baseUrl}?${trimAndStringifyUrlParams({
newPrefixedSerializedParams: {
[prefix("filters")]: serializeFilterUrlParams(toFilterValues).filters,
[FROM_ISSUES_PARAMS_KEY]: fromIssuesParams,
issueTitle: ruleReport.description.split("\n")[0],
issueTitle,
},
})}`;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export const FileIncidentsDetailModal: React.FC<
isFetching ||
(firstFiveIncidents.length > 0 && activeTabIncidentId === undefined);

const issueTitle = issue.description.split("\n")[0];
const issueTitle =
issue.description.split("\n")[0] ||
issue.name.split("\n")[0] ||
"Issue name";

return (
<Modal
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/pages/issues/issues-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ export const IssuesTable: React.FC<IIssuesTableProps> = ({ mode }) => {
{...getTdProps({ columnKey: "description" })}
modifier="truncate"
>
{report.description.split("\n")[0]}
{report?.description.split("\n")[0]}
</Td>
<Td width={20} {...getTdProps({ columnKey: "category" })}>
{report.category}
Expand Down

0 comments on commit 119e8c4

Please sign in to comment.