feat(events): let an organiser add co-hosts to an event - #447
Conversation
The event's team is the host. An organiser can now add organisations that have no team on the platform as co-hosts, shown under "Hosted by" on the event's details page. `Buzz Event.host` and `Event Host` were already "the team", badly modelled: `host_for` auto-minted one Event Host per team on create, named after the team, purely because `host` was mandatory and the create form never asked. Nothing read it. `host` is now optional and hidden, `host_for` is gone, and the two readers that printed the host name read the team's `team_name`. Event Host gains a mandatory `host_name` and autonames to a hash, so two tenants adding "Acme Corp" no longer produce "Acme Corp" and "Acme Corp-1". A patch backfills `host_name` from the docname; nothing is renamed, so existing hosts keep the names they have. Frappe discards a pre-set `doc.name` for any autoname but prompt and uuid (naming.py:161), so every site that named a host by hand had to move to `host_name` — including `_create_host`, whose `frappe.db.exists` dedupe would otherwise have minted a fresh host per proposal. `create_from_template` deliberately does not copy the host into `co_hosts`: the only host a template can carry is a legacy auto-minted one, and the event would render its own team twice.
|
✅ UI Demo Check — a screenshot or demo is attached. |
Greptile SummaryThis PR makes an event’s team its primary host and adds organiser-managed co-hosts.
Confidence Score: 5/5The PR appears safe to merge, with no outstanding findings after the legacy-host migration and team-scoped fixture lookup fixes. The duplicate co-host thread was manually resolved, the cross-team proposal lookup was correctly withdrawn, the new migration preserves legacy proposal hosts, and the E2E helper now includes the owning team in its lookup. No new actionable failures were introduced since the previous review.
|
| Filename | Overview |
|---|---|
| buzz/api/events/services.py | Exposes primary and co-host data and adds permission-gated co-host mutation services. |
| buzz/events/doctype/buzz_event/buzz_event.py | Adds co-host child-table typing and duplicate-host validation. |
| buzz/patches/backfill_event_co_hosts.py | Preserves legacy proposal-supplied hosts while excluding former team-host placeholders. |
| dashboard/src/components/dashboard/events/EventHosts.vue | Adds the Hosted by display and organiser controls for adding and removing co-hosts. |
| e2e/helpers/frappe.ts | Resolves the previous fixture issue by scoping Event Host lookup to the owning team. |
Reviews (3): Last reviewed commit: "fix(e2e): key the Event Host fixture loo..." | Re-trigger Greptile
| "name": str(row.name), | ||
| "venue": venue_of(row.venue), |
There was a problem hiding this comment.
Legacy Proposal Hosts Disappear
Existing events created from proposals store the proposal organization only in Buzz Event.host and have no rows in the new co_hosts table. This response now ignores the legacy field, so those events show only their team under “Hosted by” after migration. Add a migration or fallback that preserves legacy proposal hosts.
Knowledge Base Used:
Prompt To Fix With AI
This is a comment left during a code review.
Path: buzz/api/events/services.py
Line: 154-155
Comment:
**Legacy Proposal Hosts Disappear**
Existing events created from proposals store the proposal organization only in `Buzz Event.host` and have no rows in the new `co_hosts` table. This response now ignores the legacy field, so those events show only their team under “Hosted by” after migration. Add a migration or fallback that preserves legacy proposal hosts.
**Knowledge Base Used:**
- [Proposals and sponsorships](https://app.greptile.com/bwh-tech/-/custom-context/knowledge-base/bwhtech/buzz/-/docs/proposals-and-sponsorships.md)
- [Frappe application integration](https://app.greptile.com/bwh-tech/-/custom-context/knowledge-base/bwhtech/buzz/-/docs/frappe-application-integration.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed in f66ae0e with a new patch, backfill_event_co_hosts.
The discriminator is Event Host.host_name != Buzz Team.team_name, not the team: the proposal flow stamps the host with the event's own team, so team equality cannot separate a real proposal host from an auto-minted one. An auto-minted host is named after its team, which is exactly the "would render twice" case. Two tests cover both directions.
Five tests in test_event_proposal.py and six e2e setup files still assumed the Event Host docname was the organisation's name. They now key on `host_name`, through a new `ensureEventHost` helper on the e2e side. `create_co_host` reuses the team's host of that name instead of minting a second one. Since names stopped being docnames, adding "Acme Corp" twice produced two records with different hashes and listed the organisation twice under "Hosted by"; `validate_co_hosts` now sees the duplicate row. `backfill_event_co_hosts` carries a legacy `Buzz Event.host` into the table so proposal-supplied hosts stay on display. Hosts `host_for` auto-minted are skipped by comparing `host_name` against the team's `team_name` — the team restated, which would render twice.
Host names are not unique across teams, and the fixtures act as Administrator, who reads every team's rows.
What changed
as co-hosts, under a "Hosted by" section on the event details page.
Buzz Event.hostgoes optional and hidden.host_forauto-minted one Event Host per teampurely to satisfy
reqd, and nothing read it — deleted.utils.pyandsponsorship_enquiry.pyprinted that auto-minted name; both now read theevent team's
team_name.Event Hostgains a mandatoryhost_nameand autonames to a hash, so two tenants adding"Acme Corp" no longer get "Acme Corp" and "Acme Corp-1". The test churn is this: Frappe
discards a pre-set
doc.namefor any autoname butprompt/uuid.backfill_event_host_namescopies the docname intohost_name. Nothing is renamed;existing hosts keep the names they have.
Event CoHostchild table, onehostLink. Adding a Buzz Team as a co-host isdeliberately out of scope — it needs cross-tenant search and a consent flow.
co_hostsfromhost, so a proposal-supplied host on an existing eventno longer displays. Left open.
Demo
demo-buzz-cohost.mp4
Testing
migraterun twice ontestbuzz.localhostto confirm the patch is idempotent.add_co_host/remove_co_hostround-tripped over HTTP on the real v2 path.