diff --git a/changelog.d/fixed-18807-calendar-section-formatting.md b/changelog.d/fixed-18807-calendar-section-formatting.md new file mode 100644 index 0000000000..62aa829cf2 --- /dev/null +++ b/changelog.d/fixed-18807-calendar-section-formatting.md @@ -0,0 +1 @@ +- The Calendar section now has the Inbox's layout and spacing: each meeting is a row with status and platform chips, the title on its own line, a time line that leads with the next occurrence of a series (with "repeats weekly" after it, the first date in a tooltip, and the time zone shown once), a meta line, and grouped actions that wrap on narrow screens; a row awaiting approval is tinted and says in plain words why it waits; forwarded "FW:" and "Fwd:" prefixes are hidden in the title (display only); headings, the Add meeting disclosure and the empty states share one rhythm with the Inbox (#18807). diff --git a/dashboard/test/meetings-calendar-role-race.test.js b/dashboard/test/meetings-calendar-role-race.test.js index eb7c174fc4..b62beb8057 100644 --- a/dashboard/test/meetings-calendar-role-race.test.js +++ b/dashboard/test/meetings-calendar-role-race.test.js @@ -41,7 +41,8 @@ const MEETINGS = ['meetingsIsOwner', 'meetingsRoleKnown', 'meetingsOnRoleReady', const CALENDAR = ['calendarRoleKnown', 'calendarOnRoleReady', 'calendarCanView', 'calendarIsOwner', 'fetchCalendar', 'calendarRefreshMeetings', 'fetchMeetingDrafts', 'renderCalendar', 'renderMeetingDrafts', 'meetingDraftsSplit', 'calendarFormHtml', 'calendarViewerTimeZone', 'calendarRowHtml', 'calendarFormatTime', 'calendarPlatformLabel', 'calendarMeetingLink', 'calendarActionButtons', 'renderCalendarIndicator', - 'calendarIndicatorState', 'calendarBadgeCount', 'calendarMeetingList', 'calendarCanDelete']; + 'calendarIndicatorState', 'calendarBadgeCount', 'calendarMeetingList', 'calendarCanDelete', + 'calendarDisplayTitle', 'calendarLooksForwarded', 'calendarRepeatText', 'calendarFormatRange', 'calendarWhen', 'calendarApprovalWhy']; function makeSandbox(opts) { const els = {}; @@ -74,7 +75,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', 'MEETINGS_FINAL_STATES', 'CALENDAR_FINISHED_STATUSES'].map(extractConst); + 'CALENDAR_STATUS_LABELS', 'CALENDAR_PILL_STATUS', 'CALENDAR_FWD_PREFIX', '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); @@ -147,3 +148,28 @@ test('a failed meeting row shows a pill, a friendly line and the raw error under assert.match(html, /details<\/summary>
quorum meeting\.join/); assert.match(html, /Zoom · /); }); + +test('calendar row: forwarded prefix stripped for display, series leads with next occurrence, approval reason in words', () => { + const sb = makeSandbox({}); + sb.window._hiveRole = 'owner'; + assert.equal(sb.calendarDisplayTitle('FW: Fwd: Hive Commons Community Meeting'), 'Hive Commons Community Meeting'); + assert.equal(sb.calendarDisplayTitle('Forward planning'), 'Forward planning'); + assert.equal(sb.calendarDisplayTitle('FW:'), 'FW:'); + assert.equal(sb.calendarRepeatText('FREQ=WEEKLY;BYDAY=TH'), 'repeats weekly'); + assert.equal(sb.calendarRepeatText('FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR'), 'repeats every weekday'); + assert.equal(sb.calendarRepeatText('FREQ=DAILY;INTERVAL=2'), 'repeats every 2 days'); + const ev = { + id: 'e1', summary: 'FW: Hive Commons Community Meeting', status: 'awaiting_approval', source: 'email', platform: 'teams', + start: '2026-09-10T14:00:00Z', end: '2026-09-10T15:00:00Z', rrule: 'FREQ=WEEKLY', next_occurrences: ['2026-11-19T15:00:00Z'] + }; + const html = sb.calendarRowHtml(ev); + assert.match(html, /Hive Commons Community Meeting<\/div>/); + assert.doesNotMatch(html, />FW:/); + assert.match(html, /calendar-row-when" title="Series started /); + assert.match(html, /Next: .*· repeats weekly/); + assert.doesNotMatch(html, /· repeats ·/); + assert.match(html, /looks forwarded/); + assert.match(html, /DMARC aligned/); + assert.match(html, /calendar-row-actions/); + assert.equal(sb.calendarApprovalWhy({ status: 'scheduled', source: 'email' }), ''); +}); diff --git a/src/pkg/dashboard/static-src/css/calendar.css b/src/pkg/dashboard/static-src/css/calendar.css index 813c977ec0..38c41b9d85 100644 --- a/src/pkg/dashboard/static-src/css/calendar.css +++ b/src/pkg/dashboard/static-src/css/calendar.css @@ -1,14 +1,26 @@ /* Calendar: scheduled meetings hive joins (#18394) */ .calendar-panel { display: flex; flex-direction: column; gap: var(--sp-5); } - .calendar-subsection { display: flex; flex-direction: column; gap: var(--sp-2); } + .calendar-subsection { display: flex; flex-direction: column; gap: var(--sp-3); } + .calendar-hint { max-width: 80ch; line-height: 1.5; } + .calendar-panel .email-in { margin-bottom: var(--sp-0); } + #meeting-drafts-panel { margin-top: var(--sp-5); } + .calendar-add-summary { display: flex; align-items: center; min-height: var(--tap-target); cursor: pointer; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); } .calendar-add-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--sp-2); align-items: end; } .calendar-add-grid label { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-xs); } - .calendar-list { display: flex; flex-direction: column; gap: var(--sp-2); } - .calendar-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); } - .calendar-row[data-status="awaiting_approval"] { border-color: var(--accent); } + .calendar-list { display: flex; flex-direction: column; gap: var(--sp-3); } + /* Row: chips (status, platform), title, time line, meta line, an optional + reason, then one actions group that wraps on narrow widths. */ + .calendar-row { display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); } + .calendar-row[data-status="awaiting_approval"] { border-color: var(--accent); border-left-width: 3px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); } .calendar-row[data-status="live"] { border-color: var(--green); } - .calendar-row-main { flex: 1 1 16em; min-width: 0; } - .calendar-row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + .calendar-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); } + .calendar-row-main { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; } + .calendar-row-title { font-size: var(--fs-base); font-weight: var(--fw-semibold); overflow-wrap: anywhere; } + .calendar-row-when { font-size: var(--fs-sm); color: var(--text); } + .calendar-row-when[title] { cursor: help; } + .calendar-row-meta, .calendar-row-body { overflow-wrap: anywhere; line-height: 1.5; } + .calendar-why { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r); background: var(--bg); font-size: var(--fs-sm); line-height: 1.5; max-width: 80ch; } + .calendar-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-1); } .oc-meeting-indicator { cursor: pointer; } @media (max-width: 720px) { .calendar-add-grid { grid-template-columns: 1fr; } diff --git a/src/pkg/dashboard/static-src/css/email-in.css b/src/pkg/dashboard/static-src/css/email-in.css index fed3f3f8ad..637debf6b9 100644 --- a/src/pkg/dashboard/static-src/css/email-in.css +++ b/src/pkg/dashboard/static-src/css/email-in.css @@ -2,5 +2,5 @@ .email-in { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-5); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); } .email-in-label { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); } .email-in-address { font-family: var(--font-mono); font-size: var(--fs-base); font-weight: 600; overflow-wrap: anywhere; color: var(--accent); } - .email-in-hint { flex-basis: 100%; } + .email-in-hint { flex-basis: 100%; max-width: 80ch; line-height: 1.5; } .email-in.is-off .email-in-hint { flex-basis: auto; } diff --git a/src/pkg/dashboard/static-src/html/calendar.html b/src/pkg/dashboard/static-src/html/calendar.html index a5ef6dc402..4d44012157 100644 --- a/src/pkg/dashboard/static-src/html/calendar.html +++ b/src/pkg/dashboard/static-src/html/calendar.html @@ -2,6 +2,6 @@

Loading calendar…

-
+
diff --git a/src/pkg/dashboard/static-src/js/calendar.js b/src/pkg/dashboard/static-src/js/calendar.js index 103dd7ff38..f018d1df12 100644 --- a/src/pkg/dashboard/static-src/js/calendar.js +++ b/src/pkg/dashboard/static-src/js/calendar.js @@ -160,7 +160,7 @@ dashboardSetInterval('calendar', fetchCalendar, CALENDAR_POLL_MS); function calendarFormHtml() { - return '
Add meeting
' + + return '
Add meeting
' + '' + '' + '' + @@ -228,21 +228,98 @@ return ''; } + // A forwarded invite carries "FW:" or "Fwd:" in its title. Display only: + // the stored title is never changed. + const CALENDAR_FWD_PREFIX = /^\s*(?:(?:fw|fwd)\s*:\s*)+/i; + function calendarDisplayTitle(title) { + const s = String(title || ''); + return s.replace(CALENDAR_FWD_PREFIX, '').trim() || s; + } + function calendarLooksForwarded(title) { return CALENDAR_FWD_PREFIX.test(String(title || '')); } + + // calendarRepeatText says a recurrence rule in words ("repeats weekly"). + function calendarRepeatText(rrule) { + const rule = String(rrule || '').toUpperCase(); + if (!rule) return ''; + const part = k => { const m = rule.match(new RegExp('(?:^|;)' + k + '=([^;]+)')); return m ? m[1] : ''; }; + const n = parseInt(part('INTERVAL'), 10); + const every = (unit, word) => n > 1 ? 'repeats every ' + n + ' ' + unit + 's' : 'repeats ' + word; + switch (part('FREQ')) { + case 'DAILY': return every('day', 'daily'); + case 'WEEKLY': return part('BYDAY') === 'MO,TU,WE,TH,FR' && !(n > 1) ? 'repeats every weekday' : every('week', 'weekly'); + case 'MONTHLY': return every('month', 'monthly'); + case 'YEARLY': return every('year', 'yearly'); + default: return 'repeats on a schedule'; + } + } + + // calendarFormatRange writes one start and end in the viewer's zone with + // the zone named once, at the end: "Thu, Nov 19 · 10:00 AM – 11:00 AM EST". + function calendarFormatRange(start, end) { + const s = new Date(start); + if (!start || isNaN(s.getTime())) return ''; + const e = end ? new Date(end) : null; + const hasEnd = !!e && !isNaN(e.getTime()) && e.getTime() > s.getTime(); + try { + const day = d => new Intl.DateTimeFormat(undefined, { weekday: 'short', month: 'short', day: 'numeric' }).format(d); + const time = d => new Intl.DateTimeFormat(undefined, { hour: 'numeric', minute: '2-digit' }).format(d); + const zone = (new Intl.DateTimeFormat(undefined, { timeZoneName: 'short' }).formatToParts(s).find(p => p.type === 'timeZoneName') || {}).value || ''; + const tz = zone ? ' ' + zone : ''; + if (!hasEnd) return day(s) + ' · ' + time(s) + tz; + if (day(s) === day(e)) return day(s) + ' · ' + time(s) + ' – ' + time(e) + tz; + return day(s) + ' ' + time(s) + ' – ' + day(e) + ' ' + time(e) + tz; + } catch (err) { return s.toISOString(); } + } + + // calendarWhen is the row's time line. A series leads with its next + // occurrence and the rule after it; the first occurrence goes to the + // tooltip. A single meeting shows its own time. + function calendarWhen(e) { + const next = e.rrule ? (e.next_occurrences || [])[0] : ''; + const startMs = new Date(e.start).getTime(); + const span = e.end && !isNaN(startMs) ? new Date(e.end).getTime() - startMs : 0; + const lead = next ? calendarFormatRange(next, span > 0 ? new Date(new Date(next).getTime() + span).toISOString() : '') : calendarFormatRange(e.start, e.end); + const rule = e.rrule ? calendarRepeatText(e.rrule) : ''; + const first = calendarFormatRange(e.start, e.end); + return { + text: (next ? 'Next: ' : '') + lead + (rule ? ' · ' + rule : ''), + title: e.rrule && first ? 'Series started ' + first : '' + }; + } + + // calendarApprovalWhy says, in plain words, why a row waits for the owner. + // The rule is the scheduler's: an emailed invite is scheduled on its own + // only when its sender is the organizer, DMARC aligned and allowlisted; a + // meeting another user adds waits for the owner. + function calendarApprovalWhy(e) { + if (!e || e.status !== 'awaiting_approval') return ''; + if (e.source === 'email') { + const rule = 'Hive schedules an emailed invite on its own only when the meeting\'s organizer sent it, the sender is verified (DMARC aligned) and is on this hive\'s allowlist. '; + return calendarLooksForwarded(e.summary) + ? 'This invite looks forwarded, so it did not come from its organizer. ' + rule + 'Approve it to have hive join.' + : rule + 'This one did not meet all three. Approve it to have hive join.'; + } + if (e.source === 'manual') return 'Added by ' + (e.invited_by || 'another user') + '. The owner approves meetings other users add.'; + return 'Waiting for the owner to approve it.'; + } + function calendarRowHtml(e) { const platform = e.platform || ''; const organizer = e.organizer ? (e.organizer.name || e.organizer.email || '') : (e.invited_by || ''); - const next = (e.next_occurrences || [])[0]; const status = e.status || ''; - const times = calendarFormatTime(e.start) + (e.end ? ' – ' + calendarFormatTime(e.end) : ''); + const when = calendarWhen(e); + const why = calendarApprovalWhy(e); + const meta = [organizer, CALENDAR_SOURCE_LABELS[e.source] || e.source || '', e.status_reason || ''].filter(Boolean).map(escapeHtml).join(' · '); + const actions = calendarMeetingLink(e) + calendarActionButtons(e); return '
' + + '
' + '' + escapeHtml(CALENDAR_STATUS_LABELS[status] || status) + '' + - '' + (CALENDAR_PLATFORM_ICONS[platform] || '🎙') + ' ' + escapeHtml(calendarPlatformLabel(platform)) + '' + - '
' + escapeHtml(e.summary || e.join_url || 'Meeting') + '
' + - '
' + escapeHtml(times) + (e.rrule ? ' · repeats' : '') + - (next && e.rrule ? ' · next ' + escapeHtml(calendarFormatTime(next)) : '') + - (organizer ? ' · ' + escapeHtml(organizer) : '') + ' · ' + escapeHtml(CALENDAR_SOURCE_LABELS[e.source] || e.source || '') + - (e.status_reason ? ' · ' + escapeHtml(e.status_reason) : '') + '
' + - calendarMeetingLink(e) + calendarActionButtons(e) + '
'; + '' + (CALENDAR_PLATFORM_ICONS[platform] || '🎙') + ' ' + escapeHtml(calendarPlatformLabel(platform)) + '
' + + '
' + escapeHtml(calendarDisplayTitle(e.summary) || e.join_url || 'Meeting') + '
' + + '
' + escapeHtml(when.text) + '
' + + (meta ? '
' + meta + '
' : '') + '
' + + (why ? '
' + escapeHtml(why) + '
' : '') + + (actions ? '
' + actions + '
' : '') + '
'; } function renderCalendar() { @@ -369,19 +446,20 @@ const btn = (action, label, cls) => ''; const where = d.type === 'knowledge' ? 'knowledge vault' : (d.repo || 'no repo set'); const result = d.result_url ? ' · ' + escapeHtml(d.result_url) + '' : (d.result_note ? ' · ' + escapeHtml(d.result_note) : ''); + const actions = (d.meeting_id ? '' : '') + + (open ? btn('approve', 'Approve', 'btn-primary') + btn('reject', 'Reject', 'btn-secondary') : ''); return '
' + - '' + escapeHtml(MEETING_DRAFT_STATUS[status] || status) + '' + - '' + escapeHtml(MEETING_DRAFT_TYPES[d.type] || d.type || '') + '' + + '
' + escapeHtml(MEETING_DRAFT_STATUS[status] || status) + '' + + '' + escapeHtml(MEETING_DRAFT_TYPES[d.type] || d.type || '') + '
' + '
' + escapeHtml(d.title || '') + '
' + - '
' + escapeHtml(where) + (d.meeting_title ? ' · from ' + escapeHtml(d.meeting_title) : '') + + '
' + escapeHtml(where) + (d.meeting_title ? ' · from ' + escapeHtml(d.meeting_title) : '') + (d.requested_by ? ' · asked by ' + escapeHtml(d.requested_by) + ' (display name)' : '') + (d.auto_approved ? ' · auto-approved' : '') + (d.decided_by && !d.auto_approved ? ' · ' + escapeHtml(status) + ' by ' + escapeHtml(d.decided_by) : '') + result + (d.error ? ' · ' + escapeHtml(d.error) + '' : '') + '
' + - (d.body ? '
' + escapeHtml(d.body) + '
' : '') + + (d.body ? '
' + escapeHtml(d.body) + '
' : '') + (d.excerpt ? '
Transcript excerpt
' + escapeHtml(d.excerpt) + '
' : '') + (open ? meetingDraftEditHtml(d) : '') + '
' + - (d.meeting_id ? '' : '') + - (open ? btn('approve', 'Approve', 'btn-primary') + btn('reject', 'Reject', 'btn-secondary') : '') + '
'; + (actions ? '
' + actions + '
' : '') + '
'; } function renderMeetingDrafts() { @@ -393,7 +471,7 @@ } const split = meetingDraftsSplit((_meetingDrafts || {}).drafts); host.innerHTML = '
' + - '

Issues, RFCs, Spek sessions and knowledge notes people asked for in a meeting. Nothing is created until you approve it.

' + + '

Issues, RFCs, Spek sessions and knowledge notes people asked for in a meeting. Nothing is created until you approve it.

' + '
' + (split.pending.length ? split.pending.map(meetingDraftRowHtml).join('') : '

No drafts waiting.

') + '
' + (split.decided.length ? '
Recent (' + split.decided.length + ')
' + split.decided.map(meetingDraftRowHtml).join('') + '
' : '') + '
'; } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index c8dbc52fa3..8acf7076d4 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -6326,15 +6326,27 @@ } /* Calendar: scheduled meetings hive joins (#18394) */ .calendar-panel { display: flex; flex-direction: column; gap: var(--sp-5); } - .calendar-subsection { display: flex; flex-direction: column; gap: var(--sp-2); } + .calendar-subsection { display: flex; flex-direction: column; gap: var(--sp-3); } + .calendar-hint { max-width: 80ch; line-height: 1.5; } + .calendar-panel .email-in { margin-bottom: var(--sp-0); } + #meeting-drafts-panel { margin-top: var(--sp-5); } + .calendar-add-summary { display: flex; align-items: center; min-height: var(--tap-target); cursor: pointer; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); } .calendar-add-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--sp-2); align-items: end; } .calendar-add-grid label { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-xs); } - .calendar-list { display: flex; flex-direction: column; gap: var(--sp-2); } - .calendar-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); } - .calendar-row[data-status="awaiting_approval"] { border-color: var(--accent); } + .calendar-list { display: flex; flex-direction: column; gap: var(--sp-3); } + /* Row: chips (status, platform), title, time line, meta line, an optional + reason, then one actions group that wraps on narrow widths. */ + .calendar-row { display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); } + .calendar-row[data-status="awaiting_approval"] { border-color: var(--accent); border-left-width: 3px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); } .calendar-row[data-status="live"] { border-color: var(--green); } - .calendar-row-main { flex: 1 1 16em; min-width: 0; } - .calendar-row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + .calendar-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); } + .calendar-row-main { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; } + .calendar-row-title { font-size: var(--fs-base); font-weight: var(--fw-semibold); overflow-wrap: anywhere; } + .calendar-row-when { font-size: var(--fs-sm); color: var(--text); } + .calendar-row-when[title] { cursor: help; } + .calendar-row-meta, .calendar-row-body { overflow-wrap: anywhere; line-height: 1.5; } + .calendar-why { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r); background: var(--bg); font-size: var(--fs-sm); line-height: 1.5; max-width: 80ch; } + .calendar-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-1); } .oc-meeting-indicator { cursor: pointer; } @media (max-width: 720px) { .calendar-add-grid { grid-template-columns: 1fr; } @@ -6395,7 +6407,7 @@ .email-in { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-5); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); } .email-in-label { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); } .email-in-address { font-family: var(--font-mono); font-size: var(--fs-base); font-weight: 600; overflow-wrap: anywhere; color: var(--accent); } - .email-in-hint { flex-basis: 100%; } + .email-in-hint { flex-basis: 100%; max-width: 80ch; line-height: 1.5; } .email-in.is-off .email-in-hint { flex-basis: auto; } /* Collapsible advisory sections (#1546) */ .collapse-chevron { @@ -9579,7 +9591,7 @@

Loading calendar…

-
+
@@ -52051,7 +52063,7 @@ dashboardSetInterval('calendar', fetchCalendar, CALENDAR_POLL_MS); function calendarFormHtml() { - return '
Add meeting
' + + return '
Add meeting
' + '' + '' + '' + @@ -52119,21 +52131,98 @@ return ''; } + // A forwarded invite carries "FW:" or "Fwd:" in its title. Display only: + // the stored title is never changed. + const CALENDAR_FWD_PREFIX = /^\s*(?:(?:fw|fwd)\s*:\s*)+/i; + function calendarDisplayTitle(title) { + const s = String(title || ''); + return s.replace(CALENDAR_FWD_PREFIX, '').trim() || s; + } + function calendarLooksForwarded(title) { return CALENDAR_FWD_PREFIX.test(String(title || '')); } + + // calendarRepeatText says a recurrence rule in words ("repeats weekly"). + function calendarRepeatText(rrule) { + const rule = String(rrule || '').toUpperCase(); + if (!rule) return ''; + const part = k => { const m = rule.match(new RegExp('(?:^|;)' + k + '=([^;]+)')); return m ? m[1] : ''; }; + const n = parseInt(part('INTERVAL'), 10); + const every = (unit, word) => n > 1 ? 'repeats every ' + n + ' ' + unit + 's' : 'repeats ' + word; + switch (part('FREQ')) { + case 'DAILY': return every('day', 'daily'); + case 'WEEKLY': return part('BYDAY') === 'MO,TU,WE,TH,FR' && !(n > 1) ? 'repeats every weekday' : every('week', 'weekly'); + case 'MONTHLY': return every('month', 'monthly'); + case 'YEARLY': return every('year', 'yearly'); + default: return 'repeats on a schedule'; + } + } + + // calendarFormatRange writes one start and end in the viewer's zone with + // the zone named once, at the end: "Thu, Nov 19 · 10:00 AM – 11:00 AM EST". + function calendarFormatRange(start, end) { + const s = new Date(start); + if (!start || isNaN(s.getTime())) return ''; + const e = end ? new Date(end) : null; + const hasEnd = !!e && !isNaN(e.getTime()) && e.getTime() > s.getTime(); + try { + const day = d => new Intl.DateTimeFormat(undefined, { weekday: 'short', month: 'short', day: 'numeric' }).format(d); + const time = d => new Intl.DateTimeFormat(undefined, { hour: 'numeric', minute: '2-digit' }).format(d); + const zone = (new Intl.DateTimeFormat(undefined, { timeZoneName: 'short' }).formatToParts(s).find(p => p.type === 'timeZoneName') || {}).value || ''; + const tz = zone ? ' ' + zone : ''; + if (!hasEnd) return day(s) + ' · ' + time(s) + tz; + if (day(s) === day(e)) return day(s) + ' · ' + time(s) + ' – ' + time(e) + tz; + return day(s) + ' ' + time(s) + ' – ' + day(e) + ' ' + time(e) + tz; + } catch (err) { return s.toISOString(); } + } + + // calendarWhen is the row's time line. A series leads with its next + // occurrence and the rule after it; the first occurrence goes to the + // tooltip. A single meeting shows its own time. + function calendarWhen(e) { + const next = e.rrule ? (e.next_occurrences || [])[0] : ''; + const startMs = new Date(e.start).getTime(); + const span = e.end && !isNaN(startMs) ? new Date(e.end).getTime() - startMs : 0; + const lead = next ? calendarFormatRange(next, span > 0 ? new Date(new Date(next).getTime() + span).toISOString() : '') : calendarFormatRange(e.start, e.end); + const rule = e.rrule ? calendarRepeatText(e.rrule) : ''; + const first = calendarFormatRange(e.start, e.end); + return { + text: (next ? 'Next: ' : '') + lead + (rule ? ' · ' + rule : ''), + title: e.rrule && first ? 'Series started ' + first : '' + }; + } + + // calendarApprovalWhy says, in plain words, why a row waits for the owner. + // The rule is the scheduler's: an emailed invite is scheduled on its own + // only when its sender is the organizer, DMARC aligned and allowlisted; a + // meeting another user adds waits for the owner. + function calendarApprovalWhy(e) { + if (!e || e.status !== 'awaiting_approval') return ''; + if (e.source === 'email') { + const rule = 'Hive schedules an emailed invite on its own only when the meeting\'s organizer sent it, the sender is verified (DMARC aligned) and is on this hive\'s allowlist. '; + return calendarLooksForwarded(e.summary) + ? 'This invite looks forwarded, so it did not come from its organizer. ' + rule + 'Approve it to have hive join.' + : rule + 'This one did not meet all three. Approve it to have hive join.'; + } + if (e.source === 'manual') return 'Added by ' + (e.invited_by || 'another user') + '. The owner approves meetings other users add.'; + return 'Waiting for the owner to approve it.'; + } + function calendarRowHtml(e) { const platform = e.platform || ''; const organizer = e.organizer ? (e.organizer.name || e.organizer.email || '') : (e.invited_by || ''); - const next = (e.next_occurrences || [])[0]; const status = e.status || ''; - const times = calendarFormatTime(e.start) + (e.end ? ' – ' + calendarFormatTime(e.end) : ''); + const when = calendarWhen(e); + const why = calendarApprovalWhy(e); + const meta = [organizer, CALENDAR_SOURCE_LABELS[e.source] || e.source || '', e.status_reason || ''].filter(Boolean).map(escapeHtml).join(' · '); + const actions = calendarMeetingLink(e) + calendarActionButtons(e); return '
' + + '
' + '' + escapeHtml(CALENDAR_STATUS_LABELS[status] || status) + '' + - '' + (CALENDAR_PLATFORM_ICONS[platform] || '🎙') + ' ' + escapeHtml(calendarPlatformLabel(platform)) + '' + - '
' + escapeHtml(e.summary || e.join_url || 'Meeting') + '
' + - '
' + escapeHtml(times) + (e.rrule ? ' · repeats' : '') + - (next && e.rrule ? ' · next ' + escapeHtml(calendarFormatTime(next)) : '') + - (organizer ? ' · ' + escapeHtml(organizer) : '') + ' · ' + escapeHtml(CALENDAR_SOURCE_LABELS[e.source] || e.source || '') + - (e.status_reason ? ' · ' + escapeHtml(e.status_reason) : '') + '
' + - calendarMeetingLink(e) + calendarActionButtons(e) + '
'; + '' + (CALENDAR_PLATFORM_ICONS[platform] || '🎙') + ' ' + escapeHtml(calendarPlatformLabel(platform)) + '
' + + '
' + escapeHtml(calendarDisplayTitle(e.summary) || e.join_url || 'Meeting') + '
' + + '
' + escapeHtml(when.text) + '
' + + (meta ? '
' + meta + '
' : '') + '
' + + (why ? '
' + escapeHtml(why) + '
' : '') + + (actions ? '
' + actions + '
' : '') + '
'; } function renderCalendar() { @@ -52260,19 +52349,20 @@ const btn = (action, label, cls) => ''; const where = d.type === 'knowledge' ? 'knowledge vault' : (d.repo || 'no repo set'); const result = d.result_url ? ' · ' + escapeHtml(d.result_url) + '' : (d.result_note ? ' · ' + escapeHtml(d.result_note) : ''); + const actions = (d.meeting_id ? '' : '') + + (open ? btn('approve', 'Approve', 'btn-primary') + btn('reject', 'Reject', 'btn-secondary') : ''); return '
' + - '' + escapeHtml(MEETING_DRAFT_STATUS[status] || status) + '' + - '' + escapeHtml(MEETING_DRAFT_TYPES[d.type] || d.type || '') + '' + + '
' + escapeHtml(MEETING_DRAFT_STATUS[status] || status) + '' + + '' + escapeHtml(MEETING_DRAFT_TYPES[d.type] || d.type || '') + '
' + '
' + escapeHtml(d.title || '') + '
' + - '
' + escapeHtml(where) + (d.meeting_title ? ' · from ' + escapeHtml(d.meeting_title) : '') + + '
' + escapeHtml(where) + (d.meeting_title ? ' · from ' + escapeHtml(d.meeting_title) : '') + (d.requested_by ? ' · asked by ' + escapeHtml(d.requested_by) + ' (display name)' : '') + (d.auto_approved ? ' · auto-approved' : '') + (d.decided_by && !d.auto_approved ? ' · ' + escapeHtml(status) + ' by ' + escapeHtml(d.decided_by) : '') + result + (d.error ? ' · ' + escapeHtml(d.error) + '' : '') + '
' + - (d.body ? '
' + escapeHtml(d.body) + '
' : '') + + (d.body ? '
' + escapeHtml(d.body) + '
' : '') + (d.excerpt ? '
Transcript excerpt
' + escapeHtml(d.excerpt) + '
' : '') + (open ? meetingDraftEditHtml(d) : '') + '
' + - (d.meeting_id ? '' : '') + - (open ? btn('approve', 'Approve', 'btn-primary') + btn('reject', 'Reject', 'btn-secondary') : '') + '
'; + (actions ? '
' + actions + '
' : '') + '
'; } function renderMeetingDrafts() { @@ -52284,7 +52374,7 @@ } const split = meetingDraftsSplit((_meetingDrafts || {}).drafts); host.innerHTML = '
' + - '

Issues, RFCs, Spek sessions and knowledge notes people asked for in a meeting. Nothing is created until you approve it.

' + + '

Issues, RFCs, Spek sessions and knowledge notes people asked for in a meeting. Nothing is created until you approve it.

' + '
' + (split.pending.length ? split.pending.map(meetingDraftRowHtml).join('') : '

No drafts waiting.

') + '
' + (split.decided.length ? '
Recent (' + split.decided.length + ')
' + split.decided.map(meetingDraftRowHtml).join('') + '
' : '') + '
'; }