Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 0 additions & 8 deletions e2e/smoke/reporter-variations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ test.describe("Reporter Variations E2E", () => {

await expect(sidebar).toContainText("John Guest");
await expect(sidebar).toContainText("[email protected]");

// Timeline event for guest
await expect(page.getByText("Issue reported by John Guest")).toBeVisible();
});

test("should display guest with name only correctly", async ({ page }) => {
Expand All @@ -46,7 +43,6 @@ test.describe("Reporter Variations E2E", () => {
const sidebar = page.getByTestId("issue-sidebar");

await expect(sidebar).toContainText("Only Name");
await expect(page.getByText("Issue reported by Only Name")).toBeVisible();
});

test("should display guest with email only correctly", async ({ page }) => {
Expand All @@ -56,9 +52,6 @@ test.describe("Reporter Variations E2E", () => {

await expect(sidebar).toContainText("Anonymous");
await expect(sidebar).toContainText("[email protected]");
await expect(
page.getByText("Issue reported by [email protected]")
).toBeVisible();
});

test("should display fully anonymous reporter correctly", async ({
Expand All @@ -69,7 +62,6 @@ test.describe("Reporter Variations E2E", () => {
const sidebar = page.getByTestId("issue-sidebar");

await expect(sidebar).toContainText("Anonymous");
await expect(page.getByText("Issue reported by Guest")).toBeVisible();
});

test("should display invited user reporter correctly (legacy logic)", async ({
Expand Down
6 changes: 0 additions & 6 deletions src/components/issues/IssueTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ function TimelineItem({ event }: { event: TimelineEvent }): React.JSX.Element {
<div className="flex-1">
{isSystem ? (
<div className="flex items-center gap-2 py-1 text-xs leading-snug text-muted-foreground">
<span
className="font-medium text-foreground/80"
data-testid="timeline-system-author"
>
{event.author.name}
</span>
<span>{event.content}</span>
<span className="text-muted-foreground/40">&bull;</span>
<span
Expand Down
2 changes: 0 additions & 2 deletions src/services/issues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from "./issues";
import { db } from "~/server/db";
import { createNotification } from "~/lib/notifications";
import { createTimelineEvent } from "~/lib/timeline/events";

vi.mock("~/server/db", () => ({
db: mockDeep(),
Expand Down Expand Up @@ -143,7 +142,6 @@ describe("Issue Service", () => {

await createIssue(params);

expect(createTimelineEvent).toHaveBeenCalled();
expect(createNotification).toHaveBeenCalledWith(
{
type: "new_issue",
Expand Down
9 changes: 0 additions & 9 deletions src/services/issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,6 @@ export async function createIssue({

if (!issue) throw new Error("Issue creation failed");

// 3. Create Timeline Event
const reporterDesc =
reporterName ?? reporterEmail ?? (reportedBy ? "Member" : "Guest");
await createTimelineEvent(
issue.id,
`Issue reported by ${reporterDesc}`,
tx
);

log.info(
{
issueId: issue.id,
Expand Down
19 changes: 9 additions & 10 deletions src/test/integration/supabase/issue-services.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ describe("Issue Service Functions (Integration)", () => {
});

describe("createIssue with reporter variations", () => {
it("should create an issue with guest reporter info and correct timeline message", async () => {
it("should create an issue with guest reporter info", async () => {
const db = await getTestDb();

const guestInfo = {
Expand All @@ -233,7 +233,7 @@ describe("Issue Service Functions (Integration)", () => {
expect(issue.reporterEmail).toBe(guestInfo.reporterEmail);
expect(issue.reportedBy).toBeNull();

// Verify timeline event
// Verify no initial timeline event is created
const events = await db.query.issueComments.findMany({
where: eq(issueComments.issueId, issue.id),
orderBy: desc(issueComments.createdAt),
Expand All @@ -242,13 +242,10 @@ describe("Issue Service Functions (Integration)", () => {
const reportEvent = events.find(
(e: any) => e.isSystem && e.content.includes("Issue reported by")
);
expect(reportEvent).toBeDefined();
expect(reportEvent?.content).toBe(
`Issue reported by ${guestInfo.reporterName}`
);
expect(reportEvent).toBeUndefined();
});

it("should create an anonymous issue and correct timeline message", async () => {
it("should create an anonymous issue", async () => {
const db = await getTestDb();

const anonInfo = {
Expand All @@ -263,6 +260,7 @@ describe("Issue Service Functions (Integration)", () => {
expect(issue.reporterEmail).toBeNull();
expect(issue.reportedBy).toBeNull();

// Verify no initial timeline event is created
const events = await db.query.issueComments.findMany({
where: eq(issueComments.issueId, issue.id),
orderBy: desc(issueComments.createdAt),
Expand All @@ -271,10 +269,10 @@ describe("Issue Service Functions (Integration)", () => {
const reportEvent = events.find(
(e: any) => e.isSystem && e.content.includes("Issue reported by")
);
expect(reportEvent?.content).toBe("Issue reported by Guest");
expect(reportEvent).toBeUndefined();
});

it("should create a member issue and correct timeline message", async () => {
it("should create a member issue", async () => {
const db = await getTestDb();

const memberInfo = {
Expand All @@ -290,6 +288,7 @@ describe("Issue Service Functions (Integration)", () => {
expect(issue.reporterName).toBeNull();
expect(issue.reporterEmail).toBeNull();

// Verify no initial timeline event is created
const events = await db.query.issueComments.findMany({
where: eq(issueComments.issueId, issue.id),
orderBy: desc(issueComments.createdAt),
Expand All @@ -298,7 +297,7 @@ describe("Issue Service Functions (Integration)", () => {
const reportEvent = events.find(
(e: any) => e.isSystem && e.content.includes("Issue reported by")
);
expect(reportEvent?.content).toBe("Issue reported by Member");
expect(reportEvent).toBeUndefined();
});
});
});
8 changes: 4 additions & 4 deletions src/test/integration/supabase/issues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,14 @@ describe("Issues CRUD Operations (PGlite)", () => {
.insert(issueComments)
.values({
issueId: testIssue.id,
content: "Issue created",
content: "Status changed from new to in_progress",
isSystem: true,
authorId: null,
})
.returning();

expect(event).toBeDefined();
expect(event.content).toBe("Issue created");
expect(event.content).toBe("Status changed from new to in_progress");
expect(event.isSystem).toBe(true);
expect(event.authorId).toBeNull();
});
Expand Down Expand Up @@ -387,7 +387,7 @@ describe("Issues CRUD Operations (PGlite)", () => {
await db.insert(issueComments).values([
{
issueId: testIssue.id,
content: "Issue created",
content: "Priority changed",
isSystem: true,
createdAt: new Date(now - 3_000),
},
Expand Down Expand Up @@ -520,7 +520,7 @@ describe("Issues CRUD Operations (PGlite)", () => {
// Create timeline event
await db.insert(issueComments).values({
issueId: issue.id,
content: "Issue created",
content: "Status changed from new to in_progress",
isSystem: true,
});

Expand Down
Loading