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
1268 ).toBe(false);1268 ).toBe(false);
1269 });1269 });
1270 1270
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
1271 it("rejects a thread with no project or no pull request of its own", () => {1280 it("rejects a thread with no project or no pull request of its own", () => {
1272 expect(1281 expect(
1273 isThreadOwnPullRequest({ projectId: null, repository: "acme/app", number: 7 }, surface),1282 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
138 },138 },
139): boolean {139): boolean {
140 return (140 return (
141 thread.projectId !== null &&
141 thread.projectId === surface.projectId &&142 thread.projectId === surface.projectId &&
142 thread.repository === surface.repository &&143 thread.repository === surface.repository &&
143 thread.number === surface.number144 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