History

fix(web): require a project for thread PR ownership

shivam committed 2 months ago

Commit 9621bc01 parent 7523f6f2 files · +10 −0Browse files

Unified · Split

2 files
  1. apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts +9 −0
  2. apps/web/src/components/pullRequest/pullRequestDetail.logic.ts +1 −0
apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts+9−0
@@ -1268,6 +1268,15 @@ describe("whether the panel is showing the thread's own pull request", () => { · 1267 unmodified lines
12681268 ).toBe(false);
12691269 });
12701270
1271+ it.each([null, "proj-a"])("rejects an unlinked PR for thread project %s", (projectId) => {
1272+ expect(
1273+ isThreadOwnPullRequest(
1274+ { projectId, repository: "acme/app", number: 7 },
1275+ { ...surface, projectId: null },
1276+ ),
1277+ ).toBe(false);
1278+ });
1279+
12711280 it("rejects a thread with no project or no pull request of its own", () => {
12721281 expect(
12731282 isThreadOwnPullRequest({ projectId: null, repository: "acme/app", number: 7 }, surface),
apps/web/src/components/pullRequest/pullRequestDetail.logic.ts+1−0
@@ -138,6 +138,7 @@ export function isThreadOwnPullRequest( · 137 unmodified lines
138138 },
139139 ): boolean {
140140 return (
141+ thread.projectId !== null &&
141142 thread.projectId === surface.projectId &&
142143 thread.repository === surface.repository &&
143144 thread.number === surface.number

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t