Skip to content
Closed
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
1 change: 1 addition & 0 deletions changelog.d/added-meetings-delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Meetings: finished meetings (ended, failed, blocked, declined, left) and stale join requests get a 🗑 Delete action with an in-page confirm, plus **Clear finished** to delete all finished meetings at once. Delete removes the meeting record, its transcript and live state on the hive, erases it in Vexa with Quorum `meeting.delete` (best effort; a failure is reported and the record is still removed), and drops the Calendar entry that existed only for that meeting. Past Calendar entries get the same 🗑 Delete; scheduled ones keep Skip and Cancel. A meeting hive is still in answers 409 (leave it first). Knowledge facts and drafts made from a meeting are not touched. Owner only, audited as `meeting_delete` (`DELETE /api/meetings/{id}`, `POST /api/meetings/clear-finished`, `DELETE /api/meetings/schedule/{eid}`).
204 changes: 204 additions & 0 deletions dashboard/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,152 @@
}
}
},
"/api/meetings/clear-finished": {
"post": {
"tags": [
"Meetings"
],
"summary": "Clear finished meetings",
"description": "Owner only. Deletes every meeting in a final state that finished before `before` (RFC 3339; empty or later than now means now), each exactly like DELETE /api/meetings/{id}. Live meetings and pending join requests stay. Each deleted meeting is audited as meeting_delete.",
"requestBody": {
"required": false,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"before": {
"type": "string",
"format": "date-time"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Deleted meetings",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"deleted": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"state": {
"type": "string",
"description": "The state the meeting was in"
},
"upstream_error": {
"type": "string",
"description": "Set when Vexa (Quorum meeting.delete) could not confirm the erase; the record on this hive is removed anyway"
},
"calendar_removed": {
"type": "integer",
"description": "Calendar entries removed because they existed only for this meeting"
}
}
}
},
"count": {
"type": "integer"
}
}
}
}
}
},
"400": {
"description": "before is not an RFC 3339 time"
},
"403": {
"description": "Owner access required"
},
"503": {
"description": "Meetings are not enabled on this hive"
}
}
}
},
"/api/meetings/schedule/{eid}": {
"delete": {
"tags": [
"Meetings"
],
"summary": "Delete a past Calendar entry",
"description": "Owner only. Deletes a finished Calendar entry (ended, cancelled, declined, failed, blocked, skipped) and the meetings it created, each like DELETE /api/meetings/{id}. Entries still scheduled, awaiting approval or live keep Skip and Cancel and answer 409, as does an entry whose meeting hive is still in. Audited as meeting_schedule_delete, plus meeting_delete for each meeting.",
"parameters": [
{
"name": "eid",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "Schedule event id"
}
],
"responses": {
"200": {
"description": "Deleted",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"meetings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"state": {
"type": "string",
"description": "The state the meeting was in"
},
"upstream_error": {
"type": "string",
"description": "Set when Vexa (Quorum meeting.delete) could not confirm the erase; the record on this hive is removed anyway"
},
"calendar_removed": {
"type": "integer",
"description": "Calendar entries removed because they existed only for this meeting"
}
}
}
}
}
}
}
}
},
"403": {
"description": "Owner access required"
},
"404": {
"description": "Unknown event"
},
"409": {
"description": "The entry is still to come or live, or hive is still in its meeting"
},
"503": {
"description": "Meetings are not enabled on this hive"
}
}
}
},
"/api/meetings/{id}/decline": {
"post": {
"tags": [
Expand Down Expand Up @@ -438,6 +584,64 @@
}
},
"/api/meetings/{id}": {
"delete": {
"tags": [
"Meetings"
],
"summary": "Delete a finished meeting or a pending join request",
"description": "Owner only. Allowed for a meeting in a final state (ended, failed, blocked, declined, left, handed_off, purged) and for a pending platform join request (declined with meeting.leave, then removed). Removes the meeting record, its transcript and live state on this hive, erases it in Vexa with Quorum meeting.delete (best effort: not_found is fine, any other error is returned as upstream_error while the record is still removed) and removes the Calendar entry that existed only for this meeting. Knowledge facts and drafts already made from the meeting are not touched. Audited as meeting_delete.",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Deleted",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"state": {
"type": "string",
"description": "The state the meeting was in"
},
"upstream_error": {
"type": "string",
"description": "Set when Vexa (Quorum meeting.delete) could not confirm the erase; the record on this hive is removed anyway"
},
"calendar_removed": {
"type": "integer",
"description": "Calendar entries removed because they existed only for this meeting"
}
}
}
}
}
},
"403": {
"description": "Owner access required"
},
"404": {
"description": "Unknown meeting"
},
"409": {
"description": "Hive is still joining, in the lobby of or live in the meeting: leave the meeting first"
},
"503": {
"description": "Meetings are not enabled on this hive"
}
}
},
"get": {
"tags": [
"Meetings"
Expand Down
7 changes: 4 additions & 3 deletions dashboard/test/meetings-calendar-role-race.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ function extractConst(name) {

const GH_AUTH = ['hiveRoleSettled'];
const MEETINGS = ['meetingsIsOwner', 'meetingsRoleKnown', 'meetingsOnRoleReady', 'fetchMeetings', 'renderMeetings', 'meetingsJoinFormHtml',
'meetingsRowHtml', 'meetingsFormatTime', 'meetingsFriendlyReason', 'meetingsReasonHtml', 'meetingsLabel'];
'meetingsRowHtml', 'meetingsFormatTime', 'meetingsFriendlyReason', 'meetingsReasonHtml', 'meetingsLabel',
'meetingsFinished', 'meetingsCanDelete', 'meetingsDeleteButtonHtml'];
const CALENDAR = ['calendarRoleKnown', 'calendarOnRoleReady', 'calendarCanView', 'calendarIsOwner', 'fetchCalendar', 'calendarRefreshMeetings',
'fetchMeetingDrafts', 'renderCalendar', 'renderMeetingDrafts', 'meetingDraftsSplit', 'calendarFormHtml', 'calendarViewerTimeZone',
'calendarRowHtml', 'calendarFormatTime', 'calendarPlatformLabel', 'calendarMeetingLink', 'calendarActionButtons', 'renderCalendarIndicator',
'calendarIndicatorState', 'calendarBadgeCount', 'calendarMeetingList'];
'calendarIndicatorState', 'calendarBadgeCount', 'calendarMeetingList', 'calendarCanDelete'];

function makeSandbox(opts) {
const els = {};
Expand Down Expand Up @@ -73,7 +74,7 @@ function makeSandbox(opts) {
vm.createContext(sb);
const consts = ['MEETINGS_ERROR_INLINE_CHARS', 'MEETINGS_PLATFORM_LABELS', 'MEETINGS_PILL_STATUS', 'MEETINGS_LIVE_STATES',
'CALENDAR_ACTIVE_STATES', 'CALENDAR_DEFAULT_NAME', 'CALENDAR_PLATFORM_LABELS', 'CALENDAR_PLATFORM_ICONS', 'CALENDAR_SOURCE_LABELS',
'CALENDAR_STATUS_LABELS', 'CALENDAR_PILL_STATUS'].map(extractConst);
'CALENDAR_STATUS_LABELS', 'CALENDAR_PILL_STATUS', 'MEETINGS_FINAL_STATES', 'CALENDAR_FINISHED_STATUSES'].map(extractConst);
// const declarations stay script-scoped in a vm context; re-declare the
// mutable module state with var so the extracted functions share it.
vm.runInContext(consts.join('\n') + '\n' + GH_AUTH.concat(MEETINGS, CALENDAR).map(extractFunction).join('\n'), sb);
Expand Down
7 changes: 5 additions & 2 deletions src/cmd/hive/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3598,12 +3598,15 @@ func (b *boot) bootDashboardAPIWith(deps bootDashboardAPIDeps) {
// Drafts people ask Betty for, approved in the dashboard (#18406).
b.wireMeetingsActions(store)
// Owner API, live panel and /api/events frames (#18292).
b.dashSrv.SetMeetingsService(&meetingsDashboard{mgr: mgr, live: b.meetingsLive})
// Scheduled meetings and the Calendar section (#18394).
md := &meetingsDashboard{mgr: mgr, live: b.meetingsLive}
// Scheduled meetings and the Calendar section (#18394). Wired
// first so a deleted meeting's Calendar entry goes with it.
if svc, stop := wireMeetingsSchedule(b.cfg, mgr, b.logger); svc != nil {
b.cleanup.push(stop)
b.dashSrv.SetMeetingsScheduleService(svc)
md.sched = svc.sched
}
b.dashSrv.SetMeetingsService(md)
// Ended meetings become inbox items; transcripts are purged
// after meetings.retention_days (#18293).
b.wireMeetingsInbox(mgr, store)
Expand Down
34 changes: 33 additions & 1 deletion src/cmd/hive/meetings_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import (
"context"
"errors"
"fmt"
"time"

"github.com/hivecommons/hive/pkg/dashboard"
"github.com/hivecommons/hive/pkg/meetings"
"github.com/hivecommons/hive/pkg/meetings/live"
"github.com/hivecommons/hive/pkg/meetings/schedule"
)

// meetingsDashboard implements dashboard.MeetingsService over the meeting
Expand All @@ -16,6 +18,8 @@ import (
type meetingsDashboard struct {
mgr *meetings.Manager
live *live.Runner
// sched, when the Calendar runs, forgets a deleted meeting's entry.
sched *schedule.Scheduler
}

// meetingsDashboardError maps meetings errors onto the dashboard's
Expand All @@ -28,7 +32,8 @@ func meetingsDashboardError(err error) error {
return fmt.Errorf("%w: %v", dashboard.ErrMeetingNotFound, err)
case errors.Is(err, meetings.ErrInvalidRequest), meetings.IsCode(err, meetings.CodeInvalidArgument):
return fmt.Errorf("%w: %v", dashboard.ErrMeetingInvalid, err)
case errors.Is(err, live.ErrNotPending), errors.Is(err, live.ErrSessionEnded), errors.Is(err, meetings.ErrNotLive), errors.Is(err, meetings.ErrNotRequested):
case errors.Is(err, live.ErrNotPending), errors.Is(err, live.ErrSessionEnded), errors.Is(err, meetings.ErrNotLive), errors.Is(err, meetings.ErrNotRequested),
errors.Is(err, meetings.ErrStillRunning):
return fmt.Errorf("%w: %v", dashboard.ErrMeetingConflict, err)
default:
return err
Expand Down Expand Up @@ -101,6 +106,33 @@ func (d *meetingsDashboard) DeclineRequest(ctx context.Context, id string) (any,
return m, nil
}

// meetingDeleted is the dashboard's view of a deleted meeting; with the
// Calendar running, the entry that existed only for it goes too.
func meetingDeleted(res meetings.DeleteResult, sched *schedule.Scheduler) dashboard.MeetingDeleted {
out := dashboard.MeetingDeleted{ID: res.Meeting.ID, State: string(res.Meeting.State), UpstreamError: res.UpstreamError}
if sched != nil {
out.CalendarRemoved = sched.ForgetMeeting(res.Meeting.ID)
}
return out
}

func (d *meetingsDashboard) Delete(ctx context.Context, id string) (dashboard.MeetingDeleted, error) {
res, err := d.mgr.Delete(ctx, id)
if err != nil {
return dashboard.MeetingDeleted{}, meetingsDashboardError(err)
}
return meetingDeleted(res, d.sched), nil
}

func (d *meetingsDashboard) ClearFinished(ctx context.Context, before time.Time) ([]dashboard.MeetingDeleted, error) {
list, err := d.mgr.ClearFinished(ctx, before)
out := make([]dashboard.MeetingDeleted, 0, len(list))
for _, res := range list {
out = append(out, meetingDeleted(res, d.sched))
}
return out, meetingsDashboardError(err)
}

// meetingLive is the panel snapshot.
type meetingLive struct {
Meeting meetings.Meeting `json:"meeting"`
Expand Down
Loading
Loading