Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions web/core/components/issues/relations/issue-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,26 @@ export const RelationIssueListItem: FC<Props> = observer((props) => {
} = useIssueDetail(issueServiceType);
const project = useProject();
const { getProjectStates } = useProjectState();
const { handleRedirection } = useIssuePeekOverviewRedirection();
const { isMobile } = usePlatformOS();

// derived values
const issue = getIssueById(relationIssueId);
const { handleRedirection } = useIssuePeekOverviewRedirection(!!issue?.is_epic);
const projectDetail = (issue && issue.project_id && project.getProjectById(issue.project_id)) || undefined;
const currentIssueStateDetail =
(issue?.project_id && getProjectStates(issue?.project_id)?.find((state) => issue?.state_id == state.id)) ||
undefined;

if (!issue) return <></>;
const issueLink = `/${workspaceSlug}/projects/${projectId}/${issue.is_epic ? "epics" : "issues"}/${issue.id}`;

// handlers
const handleIssuePeekOverview = (issue: TIssue) => handleRedirection(workspaceSlug, issue, isMobile);
const handleIssuePeekOverview = (issue: TIssue) => {
if (issueServiceType === EIssueServiceType.ISSUES && issue.is_epic) {
// open epics in new tab
window.open(issueLink, "_blank");
return;
}
handleRedirection(workspaceSlug, issue, isMobile);
};
Comment on lines +68 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Test coverage missing for epic handling logic

The component issue-list-item.tsx and its epic handling logic lack test coverage. Please add unit tests to cover:

  • Epic redirection in issues service type (is_epic case)
  • Regular issue redirection
  • Link generation for both epics and regular issues

This will help ensure the reliability of the redirection logic and prevent potential regressions.

🔗 Analysis chain

Verify test coverage for the new epic handling logic.

Please ensure that there are tests covering:

  1. Epic redirection in issues service type
  2. Regular issue redirection
  3. Link generation for both epics and regular issues

Let me help you verify the test coverage:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for relevant test files and their contents
echo "Searching for test files..."
rg -l "RelationIssueListItem" -g "*.test.*" -g "*.spec.*"

echo "Searching for epic-related test cases..."
rg "is_epic" -g "*.test.*" -g "*.spec.*" -A 5

Length of output: 557


Script:

#!/bin/bash
# First, let's find all test files to understand the naming pattern
echo "Finding all test files in the repository..."
fd -t f "test|spec" -e tsx -e ts -e js -e jsx

echo -e "\nSearching for issue-related test files..."
rg -l "issue|epic" $(fd -t f "test|spec" -e tsx -e ts -e js -e jsx)

echo -e "\nSearching for the component name..."
rg -l "issue-list-item" $(fd -t f "test|spec" -e tsx -e ts -e js -e jsx)

Length of output: 740


Script:

#!/bin/bash
# Look for test files in the component's directory and nearby
echo "Searching for test files in the component directory..."
fd . web/core/components/issues/relations -t f

echo -e "\nSearching for __tests__ directories..."
fd __tests__ -t d

echo -e "\nChecking for test files with different naming patterns..."
fd -t f ".(test|spec|stories)\.(tsx|ts|jsx|js)$"

echo -e "\nLooking for the specific component's test content..."
rg -g "*.{tsx,ts,jsx,js}" -l "issue-list-item" web/core/components/issues/relations

Length of output: 1147


const handleEditIssue = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
e.stopPropagation();
Expand All @@ -85,7 +91,7 @@ export const RelationIssueListItem: FC<Props> = observer((props) => {
const handleCopyIssueLink = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
e.stopPropagation();
e.preventDefault();
issueOperations.copyText(`${workspaceSlug}/projects/${issue.project_id}/issues/${issue.id}`);
issueOperations.copyText(issueLink);
};

const handleRemoveRelation = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
Expand All @@ -98,7 +104,7 @@ export const RelationIssueListItem: FC<Props> = observer((props) => {
<div key={relationIssueId}>
<ControlLink
id={`issue-${issue.id}`}
href={`/${workspaceSlug}/projects/${issue.project_id}/issues/${issue.id}`}
href={issueLink}
onClick={() => handleIssuePeekOverview(issue)}
className="w-full cursor-pointer"
>
Expand Down
Loading