From 685c4d64ec9ad8dffdbb69f25ca5c53787807289 Mon Sep 17 00:00:00 2001 From: Harsh Tandiya Date: Thu, 8 Oct 2026 18:52:28 +0530 Subject: [PATCH 01/27] refactor(teams): rename teams to communities, is_a_community to accept_community_submissions Dashboard nav and the /manage/teams page now read Communities and show one list. The flag only marks a team that accepts event submissions, so it no longer drives grouping or the workspace subtitle. A patch keeps existing values. Buzz Team form: publishing (published, route, slug), description (short description, about) and links each get their own section on the Public Page tab. --- buzz/api/communities/submissions.py | 6 +- buzz/api/teams/__init__.py | 8 ++- buzz/api/teams/schemas.py | 4 +- buzz/api/teams/services.py | 6 +- buzz/api/teams/test_teams.py | 6 +- buzz/events/doctype/buzz_team/buzz_team.json | 66 +++++++++++++------ buzz/events/doctype/buzz_team/buzz_team.py | 2 +- buzz/events/doctype/buzz_team/team_page.py | 2 +- .../community_event_request.py | 4 +- buzz/patches.txt | 1 + buzz/patches/rename_is_a_community_field.py | 7 ++ buzz/tests/factories/buzz_team_factory.py | 2 +- .../dashboard/teams/TeamPublicPage.vue | 6 +- .../teams/settings/TeamOptionsSettings.vue | 2 +- dashboard/src/composables/useTeamSettings.ts | 6 +- dashboard/src/layouts/ManagerLayout.vue | 2 +- dashboard/src/pages/manage/MyTeams.vue | 40 ++++------- dashboard/src/router.ts | 2 +- dashboard/src/types.ts | 4 +- dashboard/src/utils/managerNavigation.test.ts | 4 +- dashboard/src/utils/managerNavigation.ts | 7 +- 21 files changed, 109 insertions(+), 78 deletions(-) create mode 100644 buzz/patches/rename_is_a_community_field.py diff --git a/buzz/api/communities/submissions.py b/buzz/api/communities/submissions.py index b9f16f47..6d81dc75 100644 --- a/buzz/api/communities/submissions.py +++ b/buzz/api/communities/submissions.py @@ -28,7 +28,11 @@ def overview(self) -> EventRequests: def open_communities(self) -> list[CommunityOption]: asked = frappe.get_all(REQUEST, filters={"event": self.event}, pluck="community") - filters = {"is_a_community": 1, "is_published": 1, "name": ["not in", [*asked, self.team]]} + filters = { + "accept_community_submissions": 1, + "is_published": 1, + "name": ["not in", [*asked, self.team]], + } rows = frappe.get_all( "Buzz Team", filters=filters, fields=["name", "team_name", "logo"], order_by="team_name" ) diff --git a/buzz/api/teams/__init__.py b/buzz/api/teams/__init__.py index 220cf4b4..4b9f53b0 100644 --- a/buzz/api/teams/__init__.py +++ b/buzz/api/teams/__init__.py @@ -27,7 +27,7 @@ def get_my_teams() -> list[TeamOption]: team.logo, team.slug, team.is_published, - team.is_a_community, + team.accept_community_submissions, team.short_description, membership.team_role, ) @@ -78,10 +78,12 @@ def update_public_page( links: list[dict], short_description: str | None = None, about: str | None = None, - is_a_community: bool = False, + accept_community_submissions: bool = False, slug: str | None = None, ) -> None: - services.update_public_page(team, is_published, links, short_description, about, is_a_community, slug) + services.update_public_page( + team, is_published, links, short_description, about, accept_community_submissions, slug + ) @frappe.whitelist() diff --git a/buzz/api/teams/schemas.py b/buzz/api/teams/schemas.py index 0f0f0c9a..a603b119 100644 --- a/buzz/api/teams/schemas.py +++ b/buzz/api/teams/schemas.py @@ -16,7 +16,7 @@ class TeamOption(APIResponse): # Every team page header links to the public page while the team is published. slug: str | None is_published: bool - is_a_community: bool + accept_community_submissions: bool short_description: str | None upcoming_event_count: int team_role: str @@ -49,7 +49,7 @@ class TeamOverview(APIResponse): slug: str | None logo: str | None is_published: bool - is_a_community: bool + accept_community_submissions: bool # Absolute page URL while published; None otherwise. public_url: str | None short_description: str | None diff --git a/buzz/api/teams/services.py b/buzz/api/teams/services.py index 73a9296c..ed78b406 100644 --- a/buzz/api/teams/services.py +++ b/buzz/api/teams/services.py @@ -22,7 +22,7 @@ "slug", "logo", "is_published", - "is_a_community", + "accept_community_submissions", "route", "short_description", "about", @@ -227,7 +227,7 @@ def update_public_page( links: list[dict], short_description: str | None, about: str | None, - is_a_community: bool = False, + accept_community_submissions: bool = False, slug: str | None = None, ) -> None: """Publish or edit a team's public page. @@ -241,7 +241,7 @@ def update_public_page( doc = frappe.get_doc("Buzz Team", team) doc.is_published = int(is_published) - doc.is_a_community = int(is_a_community) + doc.accept_community_submissions = int(accept_community_submissions) public_page.set_slug(doc, slug) doc.short_description = (short_description or "").strip() or None doc.about = about or None diff --git a/buzz/api/teams/test_teams.py b/buzz/api/teams/test_teams.py index affaed93..ed77b42c 100644 --- a/buzz/api/teams/test_teams.py +++ b/buzz/api/teams/test_teams.py @@ -86,7 +86,7 @@ def test_flags_communities(self): self.create_team(user) with self.set_user(user): - flags = {option.name: option.is_a_community for option in get_my_teams()} + flags = {option.name: option.accept_community_submissions for option in get_my_teams()} self.assertEqual(sorted(flags.values()), [False, True]) self.assertTrue(flags[community]) @@ -243,9 +243,9 @@ def test_a_viewer_cannot_edit_the_page(self): self.assertNotEqual(frappe.db.get_value("Buzz Team", self.team, "short_description"), "Hijacked") def test_a_manager_makes_the_team_a_community(self): - self.publish_as(self.manager, is_a_community=True) + self.publish_as(self.manager, accept_community_submissions=True) - self.assertTrue(self.overview().is_a_community) + self.assertTrue(self.overview().accept_community_submissions) def test_an_unpublished_page_has_no_public_url(self): self.publish_as(self.owner, is_published=False) diff --git a/buzz/events/doctype/buzz_team/buzz_team.json b/buzz/events/doctype/buzz_team/buzz_team.json index e351f110..abeaceb4 100644 --- a/buzz/events/doctype/buzz_team/buzz_team.json +++ b/buzz/events/doctype/buzz_team/buzz_team.json @@ -8,18 +8,23 @@ "engine": "InnoDB", "field_order": [ "team_name", - "slug", "section_break_hvmt", "logo", "public_page_tab", + "publishing_section", "is_published", + "column_break_route", "route", - "is_a_community", - "column_break_public", + "column_break_slug", + "slug", + "description_section", "short_description", - "section_break_about", + "column_break_about", "about", - "links" + "links_section", + "links", + "community_section", + "accept_community_submissions" ], "fields": [ { @@ -30,14 +35,6 @@ "label": "Team Name", "reqd": 1 }, - { - "description": "Used in URLs. Lowercase letters, numbers and hyphens.", - "fieldname": "slug", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Slug", - "unique": 1 - }, { "fieldname": "section_break_hvmt", "fieldtype": "Section Break" @@ -52,12 +49,20 @@ "fieldtype": "Tab Break", "label": "Public Page" }, + { + "fieldname": "publishing_section", + "fieldtype": "Section Break" + }, { "default": "0", "fieldname": "is_published", "fieldtype": "Check", "label": "Published" }, + { + "fieldname": "column_break_route", + "fieldtype": "Column Break" + }, { "description": "Where the public page lives. Filled as community/ on first publish.", "fieldname": "route", @@ -68,36 +73,57 @@ "unique": 1 }, { - "fieldname": "column_break_public", + "fieldname": "column_break_slug", "fieldtype": "Column Break" }, + { + "description": "Used in URLs. Lowercase letters, numbers and hyphens.", + "fieldname": "slug", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Slug", + "unique": 1 + }, + { + "fieldname": "description_section", + "fieldtype": "Section Break" + }, { "fieldname": "short_description", "fieldtype": "Small Text", "label": "Short Description" }, { - "fieldname": "section_break_about", - "fieldtype": "Section Break" + "fieldname": "column_break_about", + "fieldtype": "Column Break" }, { "fieldname": "about", "fieldtype": "Text Editor", "label": "About" }, + { + "fieldname": "links_section", + "fieldtype": "Section Break" + }, { "fieldname": "links", "fieldtype": "Table", "label": "Links", "options": "Event External Link" }, + { + "fieldname": "community_section", + "fieldtype": "Section Break", + "label": "Community" + }, { "default": "0", "depends_on": "is_published", - "description": "Also lists approved events from other teams.", - "fieldname": "is_a_community", + "description": "Other teams can submit their events. Approved ones are listed on the public page.", + "fieldname": "accept_community_submissions", "fieldtype": "Check", - "label": "Is a Community" + "label": "Accept Community Submissions" } ], "grid_page_length": 50, @@ -117,7 +143,7 @@ "link_fieldname": "team" } ], - "modified": "2026-10-06 14:00:00.000000", + "modified": "2026-10-08 12:00:00.000000", "modified_by": "Administrator", "module": "Events", "name": "Buzz Team", diff --git a/buzz/events/doctype/buzz_team/buzz_team.py b/buzz/events/doctype/buzz_team/buzz_team.py index 45db7bbd..fb042b71 100644 --- a/buzz/events/doctype/buzz_team/buzz_team.py +++ b/buzz/events/doctype/buzz_team/buzz_team.py @@ -77,7 +77,7 @@ def validate(self): if not self.slug: self.set_slug() # Submissions are listed on the public page, so a private team has nowhere to show them. - if self.is_a_community and not self.is_published: + if self.accept_community_submissions and not self.is_published: frappe.throw(_("Only a public team can accept community event submissions.")) # After the slug: the first publish builds the route from it. super().validate() diff --git a/buzz/events/doctype/buzz_team/team_page.py b/buzz/events/doctype/buzz_team/team_page.py index 09cd1481..d1044891 100644 --- a/buzz/events/doctype/buzz_team/team_page.py +++ b/buzz/events/doctype/buzz_team/team_page.py @@ -125,7 +125,7 @@ def attending_events(self) -> set[str]: def event_filters(self) -> dict: """The team's own events, plus those its community approved.""" filters = {"team": self.team.name} - if self.team.is_a_community: + if self.team.accept_community_submissions: approved = {"community": self.team.name, "status": "Approved"} filters["name"] = [ "in", diff --git a/buzz/events/doctype/community_event_request/community_event_request.py b/buzz/events/doctype/community_event_request/community_event_request.py index 860a7433..be2b2f53 100644 --- a/buzz/events/doctype/community_event_request/community_event_request.py +++ b/buzz/events/doctype/community_event_request/community_event_request.py @@ -41,9 +41,9 @@ def validate_event(self): def validate_community(self): community = frappe.db.get_value( - "Buzz Team", self.community, ["is_a_community", "is_published"], as_dict=True + "Buzz Team", self.community, ["accept_community_submissions", "is_published"], as_dict=True ) - if not (community and community.is_a_community and community.is_published): + if not (community and community.accept_community_submissions and community.is_published): frappe.throw(_("{0} is not a published community.").format(self.community)) if self.community == self.event_team: frappe.throw(_("A community lists its own events already.")) diff --git a/buzz/patches.txt b/buzz/patches.txt index ecde99fa..a83de640 100644 --- a/buzz/patches.txt +++ b/buzz/patches.txt @@ -30,3 +30,4 @@ buzz.patches.move_sponsorship_tier_price_to_prices buzz.patches.move_ticket_type_price_to_prices buzz.patches.create_administrator_team buzz.patches.geocode_event_venues +buzz.patches.rename_is_a_community_field diff --git a/buzz/patches/rename_is_a_community_field.py b/buzz/patches/rename_is_a_community_field.py new file mode 100644 index 00000000..96cbd900 --- /dev/null +++ b/buzz/patches/rename_is_a_community_field.py @@ -0,0 +1,7 @@ +import frappe +from frappe.model.utils.rename_field import rename_field + + +def execute(): + if frappe.db.has_column("Buzz Team", "is_a_community"): + rename_field("Buzz Team", "is_a_community", "accept_community_submissions") diff --git a/buzz/tests/factories/buzz_team_factory.py b/buzz/tests/factories/buzz_team_factory.py index 1d63639e..c243325c 100644 --- a/buzz/tests/factories/buzz_team_factory.py +++ b/buzz/tests/factories/buzz_team_factory.py @@ -39,4 +39,4 @@ def default_attributes(self) -> dict[str, Any]: @property def community(self) -> dict[str, Any]: - return {"is_published": 1, "is_a_community": 1} + return {"is_published": 1, "accept_community_submissions": 1} diff --git a/dashboard/src/components/dashboard/teams/TeamPublicPage.vue b/dashboard/src/components/dashboard/teams/TeamPublicPage.vue index fa0841fb..b56c4657 100644 --- a/dashboard/src/components/dashboard/teams/TeamPublicPage.vue +++ b/dashboard/src/components/dashboard/teams/TeamPublicPage.vue @@ -16,7 +16,7 @@ const emit = defineEmits<{ saved: [] }>() function fromTeam(team: TeamOverview) { return { is_published: team.is_published, - is_a_community: team.is_a_community, + accept_community_submissions: team.accept_community_submissions, short_description: team.short_description ?? "", about: team.about ?? "", links: team.links.map((link) => ({ ...link })) as EventExternalLink[], @@ -34,7 +34,7 @@ function differsFrom(team: TeamOverview) { // The server refuses submissions on a private team, so unpublishing turns them off. watch( () => form.is_published, - (isPublic) => !isPublic && (form.is_a_community = false), + (isPublic) => !isPublic && (form.accept_community_submissions = false), ) watch( @@ -84,7 +84,7 @@ async function save() { {{ __("Other teams can submit events. Approved ones show on this page.") }}

- +