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
9 changes: 9 additions & 0 deletions dashboard/src/data/sponsorships.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { useCall } from "frappe-ui"

// Only presence matters here: the sidebar drops its Sponsorship item for users with no
// enquiry. No cacheKey — it persists to IndexedDB and would outlive this user's session.
export function useMySponsorships() {
return useCall<{ name: string }[]>({
url: "/api/v2/method/buzz.api.sponsorships.get_user_sponsorship_inquiries",
})
}
13 changes: 10 additions & 3 deletions dashboard/src/layouts/ManagerLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import TeamSwitcher from "@/components/TeamSwitcher.vue";
import UserMenu from "@/components/UserMenu.vue";
import { useTeamAccess } from "@/composables/useTeamAccess";
import { useMySponsorships } from "@/data/sponsorships";
import NotFound from "@/pages/NotFound.vue";
import { DesktopShell, PageHeaderTarget, Sidebar, SidebarItem, SidebarLabel } from "frappe-ui";
import { computed, ref } from "vue";
Expand All @@ -16,12 +17,18 @@ const access = useTeamAccess();
// type Boolean, so Vue casts the absent prop to false and the inference never runs.
const isActive = (to: string) => route.path === to;

const personalItems = [
// Sponsorship is only worth a slot once the user has an enquiry to look at, the same
// rule the account tabs follow.
const sponsorships = useMySponsorships();

const personalItems = computed(() => [
{ label: "My Events", icon: "lucide-calendar-days", to: "/manage/events" },
{ label: "My Tickets", icon: "lucide-ticket", to: "/manage/tickets" },
{ label: "Talk Proposals", icon: "lucide-file-text", to: "/manage/proposals" },
{ label: "Sponsorship", icon: "lucide-handshake", to: "/manage/sponsorship" },
];
...(sponsorships.data?.length
? [{ label: "Sponsorship", icon: "lucide-handshake", to: "/manage/sponsorship" }]
: []),
]);

// Team-scoped destinations read the active team from data/teams rather than the path,
// so they are fixed and need no team loaded to render.
Expand Down
15 changes: 11 additions & 4 deletions e2e/tests/manage-access.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ test.describe("Manage access", () => {
await expect(page.getByRole("heading", { name: "Events", level: 1 })).toBeVisible();
});

test("routes a sidebar item with no page yet to the placeholder", async ({ page }) => {
test("routes a section with no page yet to the placeholder", async ({ page }) => {
await page.goto("/b/manage/sponsorship");

await expect(page.getByText("Work in progress")).toBeVisible({ timeout: 15000 });
});

test("hides Sponsorship from the sidebar without an enquiry", async ({ page }) => {
await page.goto("/b/manage/events");
await page.getByRole("link", { name: "Sponsorship" }).click();

await expect(page).toHaveURL(/\/b\/manage\/sponsorship$/);
await expect(page.getByText("Work in progress")).toBeVisible();
await expect(page.getByRole("link", { name: "Talk Proposals" })).toBeVisible({
timeout: 15000,
});
await expect(page.getByRole("link", { name: "Sponsorship" })).toHaveCount(0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Test assumes empty sponsorship state

This assertion relies on the shared Administrator account having no sponsorship enquiries, but the persistent test database has no setup or cleanup that establishes that state. A retained Administrator-owned enquiry correctly renders the link and makes this test fail despite valid product behavior.

Knowledge Base Used: Browser-Level E2E Test Harness

Prompt To Fix With AI
This is a comment left during a code review.
Path: e2e/tests/manage-access.spec.ts
Line: 26

Comment:
**Test assumes empty sponsorship state**

This assertion relies on the shared Administrator account having no sponsorship enquiries, but the persistent test database has no setup or cleanup that establishes that state. A retained Administrator-owned enquiry correctly renders the link and makes this test fail despite valid product behavior.

**Knowledge Base Used:** [Browser-Level E2E Test Harness](https://app.greptile.com/bwh-tech/-/custom-context/knowledge-base/bwhtech/buzz/-/docs/e2e-test-harness.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

});

test("shows a 404 for a manage section that does not exist", async ({ page }) => {
Expand Down
Loading