diff --git a/backend/internal/meeting/service.go b/backend/internal/meeting/service.go
index 6f28a4d..f488ac8 100644
--- a/backend/internal/meeting/service.go
+++ b/backend/internal/meeting/service.go
@@ -21,8 +21,10 @@ func NewService(r *Repository) (*Service, error) {
return &Service{r: r}, nil
}
-// Create validates and stores a new meeting authored by u.
-func (s *Service) Create(ctx context.Context, u *user.User, title, intent, room string, scheduledAt time.Time) (*Meeting, error) {
+// Create validates and stores a new meeting authored by u. When autoJoin is
+// true the author's "join" vote is cast immediately so the meeting reflects
+// their intent to attend.
+func (s *Service) Create(ctx context.Context, u *user.User, title, intent, room string, scheduledAt time.Time, autoJoin bool) (*Meeting, error) {
if u == nil {
slog.Error("nil user", slog.String("op", "service.Create"))
return nil, ErrInternal
@@ -47,6 +49,13 @@ func (s *Service) Create(ctx context.Context, u *user.User, title, intent, room
return nil, err
}
+ // Optionally record the author's own "join" vote straight away.
+ if autoJoin {
+ if err := s.r.UpsertVote(ctx, created.Id, u.Id, VoteJoin); err != nil {
+ return nil, err
+ }
+ }
+
// Re-read so the response carries the author name and vote aggregates.
return s.r.MeetingById(ctx, u.Id, created.Id)
}
diff --git a/backend/internal/rest/handler_meetings.go b/backend/internal/rest/handler_meetings.go
index 66431a7..a01b787 100644
--- a/backend/internal/rest/handler_meetings.go
+++ b/backend/internal/rest/handler_meetings.go
@@ -13,6 +13,9 @@ type createMeetingRequest struct {
Intent string `json:"intent"`
Room string `json:"room"`
ScheduledAt string `json:"scheduledAt"`
+ // AutoJoin asks the server to record the author's own "join" vote so the
+ // meeting carries their intent to attend from the moment it is created.
+ AutoJoin bool `json:"autoJoin"`
}
type voteMeetingRequest struct {
@@ -68,7 +71,7 @@ func (h *Handler) createMeeting(w http.ResponseWriter, r *http.Request) {
return
}
- created, err := h.meetings.Create(r.Context(), u, req.Title, req.Intent, req.Room, scheduledAt)
+ created, err := h.meetings.Create(r.Context(), u, req.Title, req.Intent, req.Room, scheduledAt, req.AutoJoin)
if err != nil {
h.fail(w, err)
return
diff --git a/frontend/src/pages/MeetingsPage.jsx b/frontend/src/pages/MeetingsPage.jsx
index bcb09d9..bcc1cdb 100644
--- a/frontend/src/pages/MeetingsPage.jsx
+++ b/frontend/src/pages/MeetingsPage.jsx
@@ -2,10 +2,13 @@ import React, { useCallback, useEffect, useState } from 'react'
import { api } from '../api.js'
// Meetings are split into three buckets relative to the current time:
-// * past - the scheduled time already passed
-// * current - happens within the next week (the default, always visible view)
+// * current - occurred within the past day, or happens within the next week
+// (the default, always visible view). Including the last day
+// keeps meetings that just happened visible for a while.
+// * past - occurred more than a day ago
// * future - happens more than a week from now
const WEEK_MS = 7 * 24 * 60 * 60 * 1000
+const DAY_MS = 24 * 60 * 60 * 1000
function categorize(meetings) {
const now = Date.now()
@@ -14,7 +17,7 @@ function categorize(meetings) {
const future = []
for (const meeting of meetings) {
const at = new Date(meeting.scheduledAt).getTime()
- if (at < now) {
+ if (at < now - DAY_MS) {
past.push(meeting)
} else if (at <= now + WEEK_MS) {
current.push(meeting)
@@ -256,7 +259,7 @@ export default function MeetingsPage({ user, onPlan }) {
{loading ? (
Loading…
) : current.length === 0 ? (
-
No meetings in the next week.
+
No meetings today or in the next week.
) : (
{current.map((meeting) => (
diff --git a/frontend/src/pages/PlanMeetingPage.jsx b/frontend/src/pages/PlanMeetingPage.jsx
index 6314809..dd1a629 100644
--- a/frontend/src/pages/PlanMeetingPage.jsx
+++ b/frontend/src/pages/PlanMeetingPage.jsx
@@ -17,6 +17,9 @@ export default function PlanMeetingPage({ onCreated, onCancel }) {
const [room, setRoom] = useState('')
// Prefill with the current date/time so the field is never empty by default.
const [scheduledAt, setScheduledAt] = useState(() => toLocalInputValue(new Date()))
+ // When checked the author is recorded as joining straight away. Checked by
+ // default, since planning a meeting usually means you intend to attend.
+ const [autoJoin, setAutoJoin] = useState(true)
const [saving, setSaving] = useState(false)
const [error, setError] = useState('')
@@ -38,6 +41,7 @@ export default function PlanMeetingPage({ onCreated, onCancel }) {
// datetime-local is local time; toISOString() produces the RFC3339 UTC
// instant the backend expects.
scheduledAt: new Date(scheduledAt).toISOString(),
+ autoJoin,
})
onCreated?.()
} catch (err) {
@@ -90,6 +94,14 @@ export default function PlanMeetingPage({ onCreated, onCancel }) {
onChange={(e) => setScheduledAt(e.target.value)}
/>
+
diff --git a/frontend/src/pages/RoomsPage.jsx b/frontend/src/pages/RoomsPage.jsx
index 41cb8ec..30423d3 100644
--- a/frontend/src/pages/RoomsPage.jsx
+++ b/frontend/src/pages/RoomsPage.jsx
@@ -2,6 +2,10 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'
import { api } from '../api.js'
import { skipGuardEnabled, setSkipGuard } from '../settings.js'
+// Meetings on the rooms page stay visible for a day after they started, so a
+// meeting the user just missed (or is still running) can still be rejoined.
+const DAY_MS = 24 * 60 * 60 * 1000
+
// Room names are case-sensitive on the Jitsi side, so we only trim, collapse
// disallowed characters into a dash, and strip leading/trailing dashes. Case is
// preserved (e.g. "DailyStandup" stays "DailyStandup").
@@ -24,6 +28,8 @@ export default function RoomsPage({ room: routeRoom, noguard, onNavigate }) {
const [room, setRoom] = useState('')
const [history, setHistory] = useState([])
const [historyLoaded, setHistoryLoaded] = useState(false)
+ // Meetings the current user voted to join, shown below the rooms grid.
+ const [meetings, setMeetings] = useState([])
const [error, setError] = useState('')
const [joining, setJoining] = useState(false)
const [copied, setCopied] = useState('')
@@ -52,10 +58,25 @@ export default function RoomsPage({ room: routeRoom, noguard, onNavigate }) {
}
}, [])
+ // The meetings list is secondary here; a failure must not block the rooms
+ // view, so it is loaded independently and errors are only logged.
+ const loadMeetings = useCallback(async () => {
+ try {
+ const data = await api.listMeetings()
+ setMeetings(data || [])
+ } catch (err) {
+ console.error(err)
+ }
+ }, [])
+
useEffect(() => {
loadHistory()
}, [loadHistory])
+ useEffect(() => {
+ loadMeetings()
+ }, [loadMeetings])
+
const enter = useCallback(async (roomName) => {
const target = sanitizeRoomName(roomName)
if (!target) {
@@ -170,6 +191,15 @@ export default function RoomsPage({ room: routeRoom, noguard, onNavigate }) {
setTimeout(() => setCopied(''), 1500)
}
+ // Meetings the user committed to attend that are upcoming or started within
+ // the last day (long-past meetings drop off).
+ const cutoff = Date.now() - DAY_MS
+ const joiningMeetings = meetings.filter(
+ (meeting) =>
+ meeting.myVote === 'join' &&
+ new Date(meeting.scheduledAt).getTime() >= cutoff,
+ )
+
return (
<>
{pending && (
@@ -288,6 +318,32 @@ export default function RoomsPage({ room: routeRoom, noguard, onNavigate }) {
)}