Skip to content

feat(events): let an organiser add co-hosts to an event - #447

Merged
harshtandiya merged 3 commits into
developfrom
refactor/hosts
Sep 8, 2026
Merged

feat(events): let an organiser add co-hosts to an event#447
harshtandiya merged 3 commits into
developfrom
refactor/hosts

Conversation

@harshtandiya

@harshtandiya harshtandiya commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • The event's team is now the host, and an organiser can add organisations with no team here
    as co-hosts, under a "Hosted by" section on the event details page.
  • Buzz Event.host goes optional and hidden. host_for auto-minted one Event Host per team
    purely to satisfy reqd, and nothing read it — deleted.
  • utils.py and sponsorship_enquiry.py printed that auto-minted name; both now read the
    event team's team_name.
  • Event Host gains a mandatory host_name and 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.name for any autoname but prompt/uuid.
  • Patch backfill_event_host_names copies the docname into host_name. Nothing is renamed;
    existing hosts keep the names they have.
  • New Event CoHost child table, one host Link. Adding a Buzz Team as a co-host is
    deliberately out of scope — it needs cross-tenant search and a consent flow.
  • Nothing backfills co_hosts from host, so a proposal-supplied host on an existing event
    no longer displays. Left open.

Demo

demo-buzz-cohost.mp4

Testing

  • 13 test modules green on the CI-parity site, including 5 new co-host tests and 2 patch tests.
  • migrate run twice on testbuzz.localhost to confirm the patch is idempotent.
  • add_co_host / remove_co_host round-tripped over HTTP on the real v2 path.
  • Not verified in a browser: the enter/leave motion and the remove confirmation dialog.

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.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

UI Demo Check — a screenshot or demo is attached.

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes an event’s team its primary host and adds organiser-managed co-hosts.

  • Adds co-host API methods, response schemas, validation, and dashboard controls.
  • Changes Event Host records to hash-based names with a required display name.
  • Migrates legacy host names and legacy event-host relationships.
  • Fixes E2E fixture lookup to scope hosts by both display name and team.

Confidence Score: 5/5

The 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.

Important Files Changed

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

Comment thread buzz/api/events/services.py Outdated
Comment thread buzz/proposals/doctype/event_proposal/event_proposal.py
Comment on lines +154 to +155
"name": str(row.name),
"venue": venue_of(row.venue),

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.

P1 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.

Fix in Claude Code Fix in Codex

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.
Comment thread e2e/helpers/frappe.ts
Host names are not unique across teams, and the fixtures act as
Administrator, who reads every team's rows.
@harshtandiya
harshtandiya merged commit 1074c0b into develop Sep 8, 2026
9 checks passed
@harshtandiya
harshtandiya deleted the refactor/hosts branch September 8, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant