Event visibility, archive and registration rules
This document states the conditions that decide three things about an event:
- Displayed — a viewer sees the event in a hub's event list, a calendar widget, the mobile app, or another list.
- Archived — the event appears in the hub's Archive list.
- Open to registration — the event page shows a working registration button.
There is no single rule for any of these. Each surface (PHP hub page, management-webapp grid, with-calendar widgets, mobile, and more) applies its own conditions, and some surfaces read MySQL while others read a Mongo copy. This document lists the rule per surface, the data each rule reads, when that data changes, and where the surfaces disagree.
This document describes the code at the commits in Version. The rules change when that code changes, so check for changes before you rely on a rule.
Version
- Written: 2026-09-24.
- Code: every rule was read from the commits below. The file names and function names in this document refer to these commits.
- Runtime facts: the hourly sweep status and the deploy tags come from Grafana Loki and GitHub tags, read on 2026-09-23.
| Repository | Branch | Commit | Commit date |
|---|---|---|---|
| backend-services | develop | a24648ebc | 2026-09-23 |
| superco-consumer | develop | ebaf9975f | 2026-09-22 |
| management-webapp | develop | 52b63842 | 2026-09-22 |
| with-calendar | master | b5ac01d | 2026-09-17 |
| superco-management | develop | fbf2727c | 2026-07-26 |
| organization-dashboard | develop | 6571eea7b | 2026-09-22 |
| sqs-consumer | master | e0a8ab0 | 2026-09-15 |
| consumer-mobile | master | 11460f1 | 2026-09-02 |
Code is not the same as production
This document describes source code, not deployments. Each environment (IL, FR, US; staging and prod) runs the version its last deploy tag points to. That version can be older or newer than the commits above. To predict what one environment does, find the commit its deploy tag points to. Then check whether the changes below are included in that commit.
Changes after these commits
Merged changes that affect this document and that the rules below do not include yet:
| Repository | Commit | Change | Affected sections |
|---|---|---|---|
| backend-services | e548f9531 (develop, 2026-09-23) | The sync now stores isExpired = ended, whatever closeIfExpired says. The sync and the hourly sweep then write the same value. | Input fields (isExpired row), Known inconsistencies item 1, and the readers that use isExpired without closeIfExpired (public event filters, RSS, facets). With this change, these readers always hide an ended event, and do not wait for the sweep. |
| sqs-consumer | c810d0c (master) | Sends the renamed sweep RPC. | When the data changes, sweep status. The sweep works in each environment where this commit is deployed. |
Open pull requests that will change this document when they merge:
- backend-services #3389 and organization-dashboard #1219 (draft on 2026-09-24): add the Displayed in Hub, Displayed in Archive and Open To Registration flags to org-dashboard Event Details. When they merge, add their rule to the organization-dashboard section.
Check for changes
This script lists the commits that changed the code this document describes, from the commits in the table to the current branch heads. Run it from the folder that contains the repository clones. If a repository prints commits, re-read the affected sections against the new code.
check() {
repo=$1; sha=$2; branch=$3; shift 3
git -C "$repo" fetch -q origin "$branch"
echo "== $repo ($sha..origin/$branch)"
git -C "$repo" log --oneline "$sha..origin/$branch" -- "$@"
}
check backend-services a24648ebc develop \
libs/utils/event-closure.util.ts libs/utils/vector-search.utils.ts libs/helpers/groups/group-approval-status.helper.ts \
apps/vector-search/src/query-builders apps/vector-search/src/aggregations apps/vector-search/src/utils \
apps/vector-search/src/search apps/groups/src/groups/queries/get-resources.queries.ts \
apps/groups/src/recurring-resources/recurring-resources.services.ts apps/groups/src/groups/groups.service.ts \
apps/groups/src/groups/groups-attributes.service.ts \
apps/external-gateway/src/controllers/registration-shared \
apps/organizations-stats/src/resources-stats/collectors/resources-stats-collector.service.ts
check superco-consumer ebaf9975f develop \
models/Groups.php models/Communities.php models/ApprovalStatuses.php models/View/GroupsList \
models/View/GroupsPageViewModel.php models/View/components/GroupActionButtons.php \
controllers/GroupsController.php controllers/SubscriptionsController.php domain/UserAccessChecker.php \
components/helpers/CommunitySettings.php jobs/UpdateResourceApproval.php jobs/RegisterBundledEvents.php \
modules/api/v1/models/ApiResource.php
check management-webapp 52b63842 develop \
src/stores/event-grid.store.ts src/stores/events-calendar.store.ts src/http-client/event-grid.client.ts \
src/components/event-grid/event-grid-header src/components/events-calendar/events-calendar-header
check with-calendar b5ac01d master \
src/providers/calendar-widget-provider/hooks/use-calendar.ts src/providers/app-provider/hooks/use-app-client.ts \
src/components/calendar-settings/utils.ts
check sqs-consumer e0a8ab0 master src/vector-search src/utils/config/cronjobs.config.ts src/cronjobs
check superco-management fbf2727c develop src/app/events
check organization-dashboard 6571eea7b develop src/components/community-events-table src/stores/community-events.store.ts
check consumer-mobile 11460f1 master lib/pages/item_page.dart
A listed commit does not always change a rule. For example, a search-ranking change can touch apps/vector-search/src/search and leave every visibility condition as it is.
To update this document:
- Re-verify the affected sections against the new code.
- Rewrite each affected section so that it states the new behaviour.
- Update the commit table and the Written date.
- Remove the rows in Changes after these commits that the new commits include.
How to use this document
- To answer "why is event X not shown in hub Y?": find which renderer hub Y uses (Which hub renderer), then read that surface's rule in Displayed. Use the QA queries to read the event's real state.
- To predict the result of a test case: use the scenario table. Each row is one event state; each column is one surface.
- Before you change a rule: read Known inconsistencies. Several surfaces copy the same rule with small differences, and a change in one place does not reach the others.
Repository short names used below:
| Short name | Repository | Role |
|---|---|---|
| PHP | superco-consumer | Legacy PHP/Yii2 consumer site: hub pages, event page, registration |
| BE | backend-services | NestJS backend: vector-search (Mongo), groups, gateways |
| MW | management-webapp | Event grid iframe (/event-grid), events calendar |
| WC | with-calendar | Embeddable calendar widgets (GRID, CAROUSEL, FULL, LITE) |
| SM | superco-management | Admin events table (co-experience / who-is-in) |
| OD | organization-dashboard | Organization dashboard (Community Events, stats) |
| SQS | sqs-consumer | Cron jobs, including the hourly vector-search sweep |
| MOB | consumer-mobile | Flutter consumer app |
Code pointers use REPO path → symbol. Line numbers are not given, because they change often.
Terms
| Term | Meaning |
|---|---|
| Event | One row in MySQL groups. Each occurrence of a recurring event is its own row. |
| Hub | A community whose page lists events (communities.id). One event can be linked to many hubs. |
| Hub link | The (hub, event) pair: one row in communities_groups (unique on community_id, group_id). Approval is stored per hub link. |
| Origin hub | The hub where the event was created: groups.original_community_id. |
| Shared-in link | A hub link whose hub is not the origin hub. |
| Cross-org share | A shared-in link whose hub belongs to a different organization than the event. |
| Connector | A groups row that represents a sub-community, not an event: parent_community_id IS NOT NULL. |
| Legacy hub | A hub page rendered by PHP from MySQL. This is the default. |
| Grid hub | A hub page that embeds the MW /event-grid iframe, which reads Mongo. |
| Mongo document | The event's document in Mongo collection vector-search-resources, keyed by (organizationId, resourceId). organizationId is the event's own organization. |
| Closed | The canonical closure rule. See Closed. |
| Ended | ends_at is set and in the past. PHP calls this getIsExpired(). It is independent of the closure fields. |
Approval statuses
Table approval_status, referenced by communities_groups.approval_status_id.
| Id | Name | Occurs on event hub links |
|---|---|---|
| 1 | Pending | Yes |
| 2 | Auto Approved | Yes |
| 3 | Approved by Admin | Yes |
| 4 | Approved by Password | No (members only) |
| 5 | Rejected | Yes |
| 6 | Banned | No |
| 7 | Ended | No |
| 8 | Pending Origin Approval | Yes. A shared-in link waits for the origin hub to approve the event. |
| 9 | Deleted | No |
| 10 | Placeholder | Yes. An unfinished facility-booking draft. |
| 11 | Auto Rejected | No |
| 12 | Rejected by Admin | No |
| 13–15 | Residency statuses | No |
| 16 | Approved via Trusted Hub | Code constant only (BE libs/enums/approval-status.enum.ts). No table row, so the foreign key does not allow it on communities_groups. |
NULL is possible after the referenced status row is deleted (ON DELETE SET NULL), or for a new share before its approval job runs.
Input fields
Every rule in this document is built from these fields.
| Concept | MySQL | Mongo vector-search-resources | Notes |
|---|---|---|---|
| Closed manually | groups.closed tinyint | No document. A manual close deletes the Mongo document (see Freshness). | Set by the admin Close action, the consumer "Delete" button (a soft close), org-dashboard batch close, the recurring reschedule, and PHP API v1. Nothing sets it when a date passes. |
| Close date | groups.close_at TIMESTAMP, UTC | closeAt | Compared with the current time on every read. |
| Close when ended ("auto-close") | groups.close_if_date_expired tinyint | closeIfExpired | On INSERT, PHP defaults it from the hub option default_close_if_expired, and forces 0 when close_at is set. Updates are not guarded, so an edited event can have both. |
| End | groups.ends_at bigint, unix seconds | endsAt | An event with no ends_at never ends. |
| Start | groups.starts_at bigint, unix seconds | startsAt | Used only by date windows. |
| Publish date | groups.published_at TIMESTAMP | publishedAt | NULL means published now. A future value hides the event from lists. |
| Private | groups.is_private tinyint | isPrivateEvent | |
| Approval in a hub | communities_groups.approval_status_id | approvedCommunities (hubs with status 2 or 3), pendingCommunities (1), rejectedCommunities (5) | Any other status (4, 8, 10, NULL, …) is in no Mongo array. |
| Registration toggle | groups.subscribe_enabled tinyint, NULL = off | not stored | |
| Registration window | groups.subscribe_enabled_at, groups.close_subscribe_enabled_at int, unix seconds | not stored | When subscribe_enabled_at is set, it replaces the toggle. |
| External registration link | groups.data_link | externalJoinUrl | When set, the event page shows an external "Join" button instead of the registration flow. |
| Capacity | groups.max_members, subscriber counts, ticket quotas | maxMembers only | "Full" is computed per request. |
| Hub renderer | options row with `key` = 'iframe_events_grid_enabled' | not stored | See Which hub renderer. |
| Org archive switch | organizations.is_archive_shown | not stored | Controls only whether MW shows the Archive button. |
Derived: isExpired | none | isExpired | Do not use this field to mean "ended". Its value depends on which writer ran last. See Known inconsistencies, item 1. |
Derived: Mongo closed | none | closed | Because manually closed events have no document, closed: true in practice means "closed by close_at or by auto-close". |
Building blocks
Closed
The canonical rule. The first matching line decides:
closed = 1→ closed (manually).close_atis set → closed ifclose_atis in the past, otherwise open.close_if_date_expiredandends_atare ignored.close_if_date_expired = 1and the event has ended → closed (auto-closed).- Otherwise → open.
Rule 2 is called close_at wins: a future close_at keeps the event open, even when auto-close is on and the event has ended.
An open event can be ended. For example, an event with close_if_date_expired = 0 and no close_at stays open for ever after it ends.
Implementations of this rule:
PHP models/Groups.php → Groups::isClosed()(the owner of the rule)BE libs/utils/event-closure.util.ts → resolveEventClosure(),isEventClosed(),buildEventClosedSql()(SQL form)- The legacy hub SQL:
PHP models/View/GroupsList/GroupsList.php → getCommonGroupsListCondition()andPHP models/Communities.php → getActiveGroups()
The Mongo predicates do not follow rule 2. See Known inconsistencies, item 2.
Approved
"Approved" means a different set of status ids in different code:
| Code | Approved set |
|---|---|
PHP (ApprovalStatuses::APPROVED_STATUSES) | 2, 3, 4, 16 |
| BE helper, org-dashboard filters, registration eligibility, monthly stats | 2, 3, 4 |
Mongo approvedCommunities, many BE group paths | 2, 3 |
Only 2 and 3 occur on event hub links today, so the three sets give the same result for events. If an event link ever gets status 4 or 16, the surfaces will disagree.
Published and private
- Published:
published_atIS NULL or in the past. - Private:
is_private = 1. - The legacy hub has one exception: when
published_atis set, it replaces the private check. The expression isIF(published_at IS NULL, NOT is_private, published_at < NOW()). Every other surface hides private events whateverpublished_atsays.
Registration window open
PHP models/Groups.php → Groups::isSubscriptionEnabled():
- Started: if
subscribe_enabled_atis set, it must be in the past; otherwisesubscribe_enabled = 1. - Not stopped:
close_subscribe_enabled_atis not set, or is in the future. - Window open = started AND not stopped.
Which hub renderer
A hub page uses one of two list implementations:
- Legacy hub (default): PHP builds the list from MySQL.
- Grid hub: the page embeds the MW
/event-gridiframe, which reads Mongo. This happens when the optioniframe_events_grid_enabledresolves to 1 for the hub (PHP components/helpers/CommunitySettings.php → isNewGridEnabled()). The option resolves from the hub's own row, then from the language default row (community_id = 0).
The two renderers apply different rules. Only grid hubs have an Archive.
Pages that are not hub pages (the related-events panel on the event page, My Events, Saved Events) always use the PHP MySQL lists.
Displayed
Legacy hub list (PHP, MySQL)
Code: PHP models/View/GroupsList/GroupsList.php → getCommonGroupsListCondition(), the panel classes in the same folder (RegularGroupsList, CheckingGroupsList, DateBasedGroupsList, SubCommunitiesList), and PHP models/Communities.php → getGroups().
Conditions for every viewer:
- The event has a hub link to this hub, and the link status is not 8 and not 10. (SQL
!=also drops NULL.) closed = 0.- Close_at wins:
IF(close_at IS NOT NULL, close_at > NOW(), close_if_date_expired = 0 OR ends_at IS NULL OR ends_at > UNIX_TIMESTAMP()). - The regular and checking panels need the matching
type_idandparent_community_id IS NULL. Connectors are listed in a separate sub-communities panel. - The calendar view also needs
starts_at IS NOT NULL. - If the hub option
close_group_on_full_regular(or_checking) is on, full events are removed.
There is no start-date window and no organization filter. So:
- Cross-org shares and events with no organization are listed.
- An ended event with
close_if_date_expired = 0stays listed, sorted last with an "expired" badge.
Conditions that depend on the viewer:
| Viewer | Extra conditions |
|---|---|
| Guest | Published-or-not-private expression (Published and private) AND status IN (2, 3, 4, 16). |
Logged-in member (not a hub admin, no resource.view_all_events) | (Own event OR the published expression) AND (own event OR status IN (2, 3, 4, 16)). A member sees their own pending and private events. |
Hub admin or resource.view_all_events holder | No publish, private or approval condition. The hub options default_admin_view.private and default_admin_view.statuses can add filters. |
Grid hub (MW /event-grid, Mongo), regular viewer
Endpoints: GET organizations/:org/communities/:cid/resources/published (guest) and /available (logged in). Both use variant=GRID.
Code: BE apps/vector-search/src/aggregations/calendar-get-match.ts → getBaseMatchQueryForRegularUsers(), BE apps/vector-search/src/query-builders/vector-search.query-builder.ts → visibleToRegularUsers(), closed(), isPrivateEvent(), afterPublished().
All conditions must hold:
- A Mongo document exists for the event. Manually closed events have none.
organizationId= the hub's organization. Cross-org shares never match.approvedCommunitiescontains the hub (status 2 or 3).closed = false.closeIfExpired = falseORisExpired = false.closeAtis NULL OR in the future.isPrivateEvent != true.publishedAtis NULL OR in the past.startsAtis NULL OR on/after 2023-01-01. The grid sends this fixed floor, so ongoing events, undated events and ended events with auto-close off stay listed.- Restricted hubs return nothing to members who are not approved, unless the hub allows
showGroupsInRestrictedCommunities.
Not checked: full events, connectors (they are indexed as subcommunity and are not excluded here).
Grid hub, admin status tabs
Shown to hub admins, leaders and canViewAllEvents holders. Code: BE apps/vector-search/src/aggregations/calendar-get-match.ts → matchAvailableCommunityResources(); tabs in MW src/components/event-grid/event-grid-header/event-grid-header.tsx.
| Tab | Condition |
|---|---|
| ACTIVE | Approved in the hub AND not private AND published AND the closed(false) conditions above |
| PENDING | pendingCommunities contains the hub (status 1 only; status 8 is in no tab) |
| REJECTED | rejectedCommunities contains the hub (status 5 only) |
| PRIVATE | isPrivateEvent = true AND publishedAt is NULL. A private event with a publish date is in no tab. |
| WAITING_FOR_PUBLISH | publishedAt in the future |
Leaders see their own pending or approved events, plus public approved published events.
with-calendar widgets (WC, Mongo)
Endpoint: GET organizations/:org/calendar/resources. Responses are cached in Redis for 5 minutes.
Code: BE apps/vector-search/src/aggregations/calendar-get-match.ts → getBaseMatchQueryForRegularUsers(), getDateRangeFilter().
Base conditions (all widget types):
- Approved in one of the calendar's configured hubs, or in any hub when none are configured.
resourceTypeis regular or checking. Connectors are excluded.- The same closure, private and publish conditions as the grid hub.
Date window:
| Widget | Window |
|---|---|
| GRID, CAROUSEL | startsAt is NULL OR startsAt ≥ the start floor. The floor is the configured start date, or now. An event disappears from these widgets once it has started. |
| FULL, LITE | startsAt in the shown range, OR the event spans the range, OR (startsAt and endsAt are both NULL AND closeAt is in the future). Undated events without a future closeAt are hidden. |
| Schedule dots | Also need startsAt set. |
Known issue (CU-123ztrcvt1h): for GRID and CAROUSEL the start floor is shifted by the organization's UTC offset. For an organization in America/Phoenix, an event that starts in the next 7 hours is already missing from the widget.
Event page by direct URL (PHP)
Code: PHP controllers/GroupsController.php → actionView(), PHP domain/UserAccessChecker.php → canViewGroup().
- The event is loaded through the hub in the URL (
getGroups()). If the hub link is missing or has status 8 or 10, every viewer, including super admins, is redirected to the hub with the message "We are sorry but the page you were trying to reach is not available." - If the event is private, or not approved in this hub (2, 3, 4, 16), only super admins, hub admins, the event's admins and
resource.view_all_eventsholders can open the page. Everyone else is redirected with the same message. - A future
published_atdoes not block the page, because of a bug inGroups::isPublished()(see Known inconsistencies, item 8). - Closed, ended and full events are not blocked. They only change the buttons.
consumer-mobile and leaders-app (MySQL)
- consumer-mobile list and search (
GET /communities/:cid/groups?filterBy[closed]=0&filterBy[isPrivate]=0):closed = 0ANDis_private = 0AND (close_if_date_expired = 0ORends_at≥ now) AND status IN (2, 3, 4).close_atandpublished_atare ignored. - consumer-mobile event page: loaded by id with no visibility check.
- leaders-app events list: status IN (2, 3, 4) AND
closed = 0ANDis_private = 0AND not a connector. No date check at all (ends_at,close_at,published_atare ignored).
AI search, public event detail, RSS, calendar filter facets (Mongo)
- Public event filters (
BE apps/vector-search/src/utils/public-event.filters.ts → getPublicEventFilters()):closed = falseANDisExpired = falseAND not private AND (closeAtNULL or future). No publish check. Approval is checked only when hub ids are given. - RSS
ACTIVE_EVENTS:closed = false,isExpired = false, not private, approved in any hub. TheTEN_LATESTand month modes apply no visibility filter. - Calendar filter facets:
closed = false,isExpired = false,isPrivateEvent = false. - These readers use
isExpiredwithoutcloseIfExpired, so an ended event with auto-close off is hidden here after the hourly sweep but shown in the grid hub. getOpenRegistrationFilter()checks onlycloseAt, despite its name.
superco-management events table
Data from PHP API v1 ({coexperience|whosin}/list).
- Rows: the hub's events from
getGroups()(status 8 and 10 hidden), excluding connectors. - Status column:
PHP models/Groups.php → Groups::getClosedStatus(). The first match decides:- Auto closed:
close_if_date_expired = 1AND ended. This is checked beforeclose_at, so it differs from the canonical rule. - Closed: the canonical rule says closed (manual or past
close_at). - Expired: ended, not closed.
- Full: the origin hub closes on full AND the event is full.
- Active.
- Auto closed:
- Admins can switch only between Active and Closed, by writing
closed. Switching Closed → Active cannot reopen an event whoseclose_athas passed.
organization-dashboard
- Community Events → Event Details lists every hub link where the hub is the selected hub AND
groups.organization_idis the dashboard organization. With no filter, it lists closed, private, pending, rejected, status 8, 10 and NULL rows, and connectors. Cross-org shares and events with no organization are not listed. - Stats tab, Events page, Reports ("Active" column, "Event Status" filter) read Mongo
monthly-resources-stats.isActive= not closed manually AND not private AND (close_if_date_expired = 0ORends_atNULL ORends_atin the future) AND approved (2, 3, 4) in any hub. It ignoresclose_atandpublished_at. The value is recomputed only after the event or its subscribers change, never because a date passed.
Archived
Grid Archive (the ARCHIVED toggle in MW /event-grid)
This is the only list that shows archived events on their own.
When it exists:
- Only on grid hubs. Legacy hubs have no archive.
- MW shows the button only when
organizations.is_archive_shown = 1. The backend does not check this switch. - Only regular events (
EventGridTypeEnum.REGULAR) are fetched.
Conditions (BE apps/vector-search/src/aggregations/calendar-get-match.ts → matchArchivedResources(), vectorSearchArchivedEventsMatch()):
- A Mongo document exists. Manually closed events have none, so manually closed events are never in the Archive.
organizationId= the hub's organization ANDapprovedCommunitiescontains the hub.closed = trueOR (isExpired = trueANDcloseIfExpired = true).isPrivateEvent != true.- No publish check and no date window.
Consequences:
- An event closed by
close_atenters the Archive only after the Mongo document getsclosed = true. That happens at the next resync of the event or at the hourly sweep. Until then, the event is in neither the hub nor the Archive. - An ended event with auto-close on enters the Archive after the sweep or a resync sets
isExpired = true. - An ended event with auto-close off is never archived. It stays in the hub.
- An event with a future
close_at, auto-close on, and a pastends_atis archived, although the canonical rule says it is open.
Events calendar "Show archived events" (MW)
A checkbox in the MW events calendar (MW src/components/events-calendar/events-calendar-header/events-calendar-header.tsx). It sends isArchivedIncluded: true, which removes the closure conditions but keeps approved, not private and published. Closed events are mixed in with live events. The is_archive_shown switch does not apply. Manually closed events still do not appear, because they have no Mongo document.
Open to registration
The registration button appears only on the event page. Lists, widgets and grid cards have no button.
Consumer event page, logged-in viewer
Code: PHP models/View/GroupsPageViewModel.php → getActionButtons(). The first matching step decides:
- Restricted hub view → the restricted rules (next section).
- Status 5 (Rejected) → no buttons. Status 1 (Pending) → an Approve button for approvers only. Other statuses fall through; non-admins cannot open the page for them anyway (Event page).
- The event is sold through a bundle → "Register through the bundle" redirect.
data_linkis set → an external "Join" button. No other checks, so it shows even when the event is closed or ended.- Registration window not open → no button.
- The viewer has an unpaid order → a "Pay" button (also after the event ended).
- Closed OR ended → a disabled button. The label is the hub option
group_expired_regular_text/group_expired_checking_text, default "Time is up!". - Already registered → cancel, or register again when multi-registration is on. Per-user maximum reached → "maxed" state.
- Full (capacity or a mandatory sold-out ticket) → a waitlist button, or "Full".
- Waitlist priority lock → blocked.
- Otherwise → the registration button.
Consumer event page, guest or restricted viewer
Code: PHP models/View/GroupsPageViewModel.php → getGuestActionButtons().
- Not approved in this hub (2, 3, 4, 16), or a restricted hub and the viewer is not an approved member → no buttons.
- Bundle redirect; then
data_link→ "Join" (also when closed or ended). - Closed OR ended → the disabled "Time is up!" button. Here this check comes before the registration window.
- Full → waitlist or "Full".
- Registration window open AND the viewer may register → the registration button. Guests cannot register on hubs with
is_approved_members_only.
Event-level summary
For a viewer who is allowed to register, the event is open to registration when all of these hold:
- approved in the viewing hub;
- not sold through a bundle;
data_linkis empty (otherwise the event shows "Join" instead);- the registration window is open;
- not closed (canonical rule);
- not ended;
- not full.
Per-viewer conditions come on top: logged in, not banned, approved member on restricted hubs, not already registered, per-user maximum, no unpaid order, waitlist priority, age limit.
Server-side checks
The server checks are weaker than the buttons. A direct request can succeed where the page shows no button.
| Endpoint | Checks | Does not check |
|---|---|---|
PHP POST /site/groups/users-subscribe (GroupsController::actionUsersSubscribe()) | Registration window, not closed, approved in the hub (2, 3, 4, 16), approved member on restricted hubs, duplicates and unpaid orders, capacity (waitlist bypass), priority lock, per-user max, age | Plain ends_at (only through the auto-close rule), is_private, published_at, data_link, bundle |
PHP jobs/RegisterBundledEvents.php | Same as users-subscribe | Same gaps |
PHP subscribe modal and form loaders (SubscriptionsController::actionGetSubscribeModal() and related) | Closed OR ended, capacity (unless invited), priority lock, can('subscribe') | |
PHP subscribe after login (GroupsController::actionSubscribeAfterLogin()) | The event is linked to the hub. The data_link branch saves the registration with no other check; the other branch checks closed OR ended. | Approval and closure on the data_link branch |
PHP subscribe external (GroupsController::actionSubscribeExternal()) | Only that the hub link is not 8 or 10 | Access control, approval, closure, ended, registration window, whether data_link is set |
BE POST resources/:id/registration and registration-form (registration-eligibility.service.ts → RegistrationEligibilityService). Used by the MW /registration form, the consumer ?registrationBackdoor=true flow and consumer-mobile. | subscribe_enabled, closed, the hub link status IN (2, 3, 4), waitlist or ticket quota full, per-user checks | close_at, close_if_date_expired, ends_at, the registration window, max_members, mandatory tickets, private, published |
consumer-mobile
The mobile event page always shows a Register button. It opens the web event page with ?jwt=, so the web rules above apply.
When the data changes
| Data | Refreshed by | Delay |
|---|---|---|
| MySQL fields | Direct writes. Time-based states are computed on every read. | None |
| Mongo document | The RESOURCE_UPDATED event on Redis stream groups-channel, published by PHP saves and by backend hub-link writes. The sync rewrites the whole document. | Near real time |
| Mongo document of a closed event | A manual close through closeResourcesByIds or closeSubcommunity deletes the document. The sync reads only rows with closed = 0, so the document comes back only after a reopen. | Immediate |
| Mongo approval of shared-in links after the origin approval changes | PHP queue jobs (GroupAfterSaveActions → UpdateResourceApproval per shared hub), then a sync | Queue delay |
Mongo isExpired and closed for passed dates | The hourly SQS cron vectorSearch.syncVectorSearchResources: sets isExpired = true for every document whose endsAt passed, and closed = true once closeAt passed. | Up to 1 hour |
monthly-resources-stats isActive | Marked dirty on RESOURCE_UPDATED / SUBSCRIBER_UPDATED, recomputed by a per-minute cycle | 10–25 minutes after an edit. Never because a date passed. |
| with-calendar responses | Redis response cache | Up to 5 minutes |
Closes that change only MySQL and leave a stale Mongo document with closed: false:
- the recurring series reschedule (
BE apps/groups/src/groups/groups.service.ts → closeManyGroupsIds()), for example when a series goes from 10 dates to 8; - PHP API v1
closedStatus/isClosedsaves (superco-management Status edits).
A later sync cannot repair these documents, because the sync skips closed rows. The event stays in the grid hub and the widgets until its old closeAt or endsAt passes and the sweep runs.
Hourly sweep status on 2026-09-24: the sweep fails in FR prod and FR staging since 2026-09-17 ("There is no matching message handler defined in the remote service."). The likely cause: backend PR #3339 renamed the RPC, and the sqs-consumer version deployed there still sends the old name UPDATE_CLOSE_IF_EXPIRED_RESOURCES. The fix (sqs-consumer commit c810d0c) is deployed in US prod only. While the sweep fails, events closed by close_at never reach the Archive unless they are resynced. The first successful run repairs every document.
Scenario table
Base event: approved (2 or 3) in the hub, public, published, open, starts in the future, registration window open, no data_link, not full. Each row changes only what it names.
Columns:
- Legacy hub: guest or regular member on a legacy hub.
- Grid hub: regular viewer on a grid hub.
- Archive: the grid Archive (org
is_archive_shown = 1). - Widget: with-calendar GRID or CAROUSEL.
- Page: a non-admin opens the event page by URL.
- Button: what a logged-in, eligible member sees on the page.
| # | Event state | Legacy hub | Grid hub | Archive | Widget | Page | Button |
|---|---|---|---|---|---|---|---|
| 1 | Base event | Yes | Yes | No | Yes | Opens | Register |
| 2 | Started, not ended | Yes | Yes | No | No | Opens | Register |
| 3 | Ended, auto-close off, no close_at | Yes, last, "expired" badge | Yes | No | No | Opens | "Time is up!" |
| 4 | Ended, auto-close on, no close_at | No | No after a resync or sweep; Yes before | Yes after a resync or sweep; No before | No | Opens | "Time is up!" |
| 5 | close_at passed | No | No | Yes after a resync or sweep; No before | No | Opens | "Time is up!" |
| 6 | close_at in the future, auto-close on, ended | Yes | No after a resync or sweep; Yes before | Yes after a resync or sweep; No before | No | Opens | "Time is up!" (ended) |
| 7 | close_at in the future, not ended | Yes | Yes | No | Yes | Opens | Register |
| 8 | Closed manually (admin Close, consumer Delete, batch close) | No | No (no document) | No (no document) | No | Opens | "Time is up!" |
| 9 | Closed by a recurring reschedule or superco-management Status edit | No | Yes (stale document) | No | Yes (stale document) | Opens | "Time is up!" |
| 10 | Private, no published_at | No (member: only own events) | No | No | No | Redirect | — |
| 11 | Private, published_at in the past | Yes | No | No | No | Redirect | — |
| 12 | published_at in the future | No | No | No | No | Opens (bug) | Register |
| 13 | Pending (1) in this hub | No (member: only own events) | No (admin PENDING tab) | No | No | Redirect | — |
| 14 | Rejected (5) in this hub | No | No (admin REJECTED tab) | No | No | Redirect | — |
| 15 | Pending origin (8) or Placeholder (10) | No, also for admins | No, in no admin tab | No | No | Redirect for everyone | — |
| 16 | Shared into a hub of another organization, approved | Yes | No (document keyed by origin org) | No | No | Opens | Register |
| 17 | Full | No if the hub option close_group_on_full_<type> is on; otherwise Yes | Yes | No | Yes | Opens | Waitlist or "Full" |
| 18 | data_link set | Yes | Yes | No | Yes | Opens | "Join", also when closed or ended |
| 19 | Registration toggle off (subscribe_enabled 0 or NULL), no window | Yes | Yes | No | Yes | Opens | None |
| 20 | subscribe_enabled_at in the future, or close_subscribe_enabled_at passed | Yes | Yes | No | Yes | Opens | None |
| 21 | No starts_at and no ends_at | Yes (not in the calendar view) | Yes | No | Yes (GRID/CAROUSEL); FULL/LITE only with a future close_at | Opens | Register |
| 22 | Connector (parent_community_id set) | In the sub-communities panel | Not excluded by the query | No | No | n/a | n/a |
| 23 | No Mongo document (for example created_by NULL, or the org mapping is missing) | Yes | No | No | No | Opens | Register |
Notes:
- Rows 4, 5 and 6 depend on the Mongo freshness rules in When the data changes.
- Row 6 exists only for edited events, because an INSERT with
close_atforces auto-close off. - Row 12: a future publish date never blocks the event page, so a user with the URL can register.
- Rows 3 and 19–20: a direct
POST /site/groups/users-subscribestill accepts a registration for row 3, and for private events (row 10), because the server does not check plainends_atoris_private. - Hub admins and
resource.view_all_eventsholders see more on the legacy hub (rows 10–14) and can open every page except row 15.
Known inconsistencies
Each item is a place where two surfaces or two writers disagree. Items with a ticket are tracked there.
- Mongo
isExpiredhas two meanings (CU-123ztrcwz02; fixed on backend-services develop bye548f9531, see Changes after these commits). The sync writescloseIfExpired && ended. The hourly sweep writestruefor every ended document. So an ended event with auto-close off hasisExpired = falseafter a resync andtrueafter a sweep. Readers that useisExpiredwithoutcloseIfExpired(public event filters, RSS, facets, the MW "expired" badge) flip between the two. - Mongo breaks close_at wins. The grid hub requires (
closeIfExpired = falseORisExpired = false) even whencloseAtis in the future, and the Archive includes (isExpiredANDcloseIfExpired) without looking atcloseAt. Scenario row 6. The same pattern is incalendar-get-resources.aggregation.ts,calendar-get-resource-schedule.aggregation.ts,get-resource-status-counter.aggregation.ts,search-resource.aggregation.ts,vector-search-resource.aggregation.tsandmongodb.service.ts → calculateResourceStatus(). - The Archive has no live
closeAtcheck. The hub checkscloseAtagainst the current time; the Archive needs the storedclosed = true. Between the close date and the next resync or sweep, the event is in neither list. - A manual close deletes the Mongo document, so manually closed events are never in the Archive and are absent from every Mongo reader.
- Some closes leave stale Mongo documents (recurring reschedule, PHP API v1 saves). Scenario row 9.
- Legacy and grid hubs apply different rules: close_at wins, the approved set,
published_atoverridingis_private, full events, connectors, cross-org shares, and the start window. - Status 8 and 10 are hidden by PHP for everyone, are in no Mongo array, and are listed in org-dashboard Event Details (status 8 is counted as pending there).
Groups::isPublished()always returns true.X ?? 0 < time()parses asX ?? (0 < time()). A future publish date hides the event from lists but not from its page.published_atoverridesis_privateonly in the legacy hub. The card appears, but a non-admin who clicks it is redirected.- Registration server checks are weaker than the buttons.
users-subscribeandRegisterBundledEventsignore plainends_at,is_privateandpublished_at.subscribe-externalhas no guards.RegistrationEligibilityServiceignoresclose_at,ends_at, the registration window andmax_members. - The logged-in button builder stops only on status 1 and 5. An admin who opens an event with another non-approved status sees a working Register button.
- Only the legacy hub hides full events. Mongo has no notion of full.
- The widget start floor is shifted by the org's UTC offset (CU-123ztrcvt1h).
- Three status vocabularies: superco-management
getClosedStatus()(Auto closed first; has Expired and Full), backendEventClosureStateEnum(canonical order; no Expired, no Full), and MongoisExpired. - Monthly stats "Active" ignores
close_atandpublished_at, treats private as inactive, accepts approval in any hub, and is not recomputed when a date passes. - Approval arrays can be truncated for events shared into roughly 120 hubs or more, because the sync builds them with
GROUP_CONCATand the MySQL defaultgroup_concat_max_lenis 1024.
QA queries
Replace the :placeholders before you run a query. In MySQL, groups and key are reserved words and need backticks.
MySQL: full state of one event in every hub
SELECT
g.id,
g.`name`,
cg.community_id AS hub_id,
(cg.community_id = g.original_community_id) AS is_origin_hub,
cg.approval_status_id,
s.name AS approval_status,
g.closed,
g.close_at,
g.close_if_date_expired,
FROM_UNIXTIME(g.starts_at) AS starts_at_utc,
FROM_UNIXTIME(g.ends_at) AS ends_at_utc,
(g.ends_at > 0 AND g.ends_at < UNIX_TIMESTAMP()) AS is_ended,
(COALESCE(g.closed, 0) = 1
OR IF(g.close_at IS NOT NULL,
g.close_at < CURRENT_TIMESTAMP(),
COALESCE(g.close_if_date_expired, 0) = 1
AND COALESCE(g.ends_at, 0) > 0
AND g.ends_at < UNIX_TIMESTAMP())) AS is_closed,
g.is_private,
g.published_at,
(g.published_at IS NULL OR g.published_at < CURRENT_TIMESTAMP()) AS is_published,
g.subscribe_enabled,
FROM_UNIXTIME(g.subscribe_enabled_at) AS subscribe_enabled_at_utc,
FROM_UNIXTIME(g.close_subscribe_enabled_at) AS close_subscribe_enabled_at_utc,
g.data_link,
g.parent_community_id,
g.organization_id
FROM `groups` g
JOIN communities_groups cg ON cg.group_id = g.id
LEFT JOIN approval_status s ON s.id = cg.approval_status_id
WHERE g.id = :event_id;
FROM_UNIXTIME uses the session time zone. Run SET time_zone = '+00:00'; first to read the values in UTC.
MySQL: is the event in the legacy hub list for a guest?
SELECT g.id
FROM `groups` g
JOIN communities_groups cg ON cg.group_id = g.id AND cg.community_id = :hub_id
WHERE g.id = :event_id
AND cg.approval_status_id IN (2, 3, 4)
AND g.closed = 0
AND IF(g.close_at IS NOT NULL,
g.close_at > CURRENT_TIMESTAMP(),
g.close_if_date_expired = 0 OR g.ends_at IS NULL OR g.ends_at > UNIX_TIMESTAMP())
AND IF(g.published_at IS NULL, NOT g.is_private, g.published_at < CURRENT_TIMESTAMP())
AND g.parent_community_id IS NULL;
One row means Yes. This query does not apply the full-event option.
MySQL: which renderer does a hub use, and is the org archive on?
SELECT community_id, lang, value
FROM options
WHERE `key` = 'iframe_events_grid_enabled'
AND community_id IN (:hub_id, 0);
SELECT o.id, o.is_archive_shown
FROM organizations o
JOIN organizations_communities oc ON oc.organization_id = o.id
WHERE oc.community_id = :hub_id;
The hub's own row wins over the default row (community_id = 0). Value 1 means a grid hub.
MySQL: find sample events for a scenario
Ended, auto-close off, still open (scenario row 3):
SELECT g.id, cg.community_id
FROM `groups` g
JOIN communities_groups cg ON cg.group_id = g.id AND cg.approval_status_id IN (2, 3)
WHERE g.closed = 0 AND g.close_at IS NULL
AND COALESCE(g.close_if_date_expired, 0) = 0
AND g.ends_at > 0 AND g.ends_at < UNIX_TIMESTAMP()
AND g.is_private = 0 AND g.parent_community_id IS NULL
LIMIT 20;
Future close_at, auto-close on, ended (scenario row 6):
SELECT g.id
FROM `groups` g
WHERE COALESCE(g.closed, 0) = 0
AND g.close_at > CURRENT_TIMESTAMP()
AND g.close_if_date_expired = 1
AND g.ends_at > 0 AND g.ends_at < UNIX_TIMESTAMP()
LIMIT 20;
Change the WHERE clause to match another row of the scenario table.
Mongo: the event's document
db.getCollection('vector-search-resources').findOne(
{ organizationId: ORG_ID, resourceId: EVENT_ID },
{
closed: 1,
isExpired: 1,
closeIfExpired: 1,
closeAt: 1,
startsAt: 1,
endsAt: 1,
publishedAt: 1,
isPrivateEvent: 1,
approvedCommunities: 1,
pendingCommunities: 1,
rejectedCommunities: 1,
resourceType: 1,
externalJoinUrl: 1,
updatedAt: 1,
}
);
null means there is no document: the event is closed manually, belongs to no organization, or has no valid creator. To spot a stale document, compare these fields with the MySQL query above. Do not compare updatedAt: the sync writes the document only when its content hash changes.
Mongo: is the event in the grid hub for a regular viewer?
const now = new Date();
db.getCollection('vector-search-resources').countDocuments({
organizationId: ORG_ID,
resourceId: EVENT_ID,
approvedCommunities: HUB_ID,
closed: false,
isPrivateEvent: { $ne: true },
$and: [
{ $or: [{ closeIfExpired: false }, { isExpired: false }] },
{ $or: [{ closeAt: null }, { closeAt: { $gt: now } }] },
{ $or: [{ publishedAt: null }, { publishedAt: { $lt: now } }] },
{ $or: [{ startsAt: null }, { startsAt: { $gte: new Date('2023-01-01T00:00:00Z') } }] },
],
});
Mongo: is the event in the grid Archive?
db.getCollection('vector-search-resources').countDocuments({
organizationId: ORG_ID,
resourceId: EVENT_ID,
approvedCommunities: HUB_ID,
isPrivateEvent: { $ne: true },
$or: [{ closed: true }, { isExpired: true, closeIfExpired: true }],
});
A result of 1 means Yes. The MW button is shown only when the org's is_archive_shown = 1.
Code index
| Surface | Code |
|---|---|
| Canonical closure | PHP models/Groups.php → isClosed(), getIsExpired(), getClosedStatus(); BE libs/utils/event-closure.util.ts |
| Registration window, publish check | PHP models/Groups.php → isSubscriptionEnabled(), isPublished() |
| Legacy hub lists | PHP models/View/GroupsList/*.php; PHP models/Communities.php → getGroups(), getActiveGroups() |
| Hub renderer switch | PHP components/helpers/CommunitySettings.php → isNewGridEnabled() |
| Event page access | PHP controllers/GroupsController.php → actionView(); PHP domain/UserAccessChecker.php → canViewGroup() |
| Registration buttons | PHP models/View/GroupsPageViewModel.php → getActionButtons(), getGuestActionButtons() |
| Registration endpoints | PHP controllers/GroupsController.php → actionUsersSubscribe(), actionSubscribeAfterLogin(), actionSubscribeExternal(); BE apps/external-gateway/src/controllers/registration-shared/registration-eligibility.service.ts |
| Mongo predicates | BE apps/vector-search/src/query-builders/vector-search.query-builder.ts; BE apps/vector-search/src/aggregations/calendar-get-match.ts |
| Mongo sync mapping | BE libs/utils/vector-search.utils.ts → getVectorSearchDocument(); BE apps/vector-search/src/search/vector-search.service.ts → addResourcesStatusAndSharedCommunities() |
| Mongo sweep and close | BE apps/vector-search/src/search/services/mongodb.service.ts → updateExpiredOrganizationResources(), closeOrganizationResourcesWithPassedCloseDate(), closeVectorSearchResource(); SQS src/vector-search/vector-search.service.ts → syncResources() |
| Manual close and reopen | BE apps/groups/src/recurring-resources/recurring-resources.services.ts → closeResourcesByIds(), reopenResourcesByIds() |
| Monthly stats Active | BE apps/organizations-stats/src/resources-stats/collectors/resources-stats-collector.service.ts |
| Org-dashboard Event Details | BE apps/groups/src/groups/groups-attributes.service.ts → getOrganizationCommunityGroupsPaginated() |