Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

People: you appear with your company and the address from the invite, instead of under Other people

Eric Brownrout7c5b4de29220
diff --git a/app/e2e/peopleCalendar.spec.ts b/app/e2e/peopleCalendar.spec.ts
index bcf33a82..27a058da 100644
--- a/app/e2e/peopleCalendar.spec.ts
+++ b/app/e2e/peopleCalendar.spec.ts
@@ -14,7 +14,7 @@ for (const theme of ['light', 'dark'] as const) test(`split metadata popovers st
const [meeting] = await page.evaluate(() => window.yogurt.meetings.cards({ limit: 1 }))
await page.clock.setFixedTime(meeting.startedAt)
const events = [{ id: 'linked-event', title: 'Planning with Jamie', start: new Date(meeting.startedAt).toISOString(), end: new Date(meeting.startedAt + 1_800_000).toISOString(),
- attendees: [{ name: 'Jamie Quill', email: '[email protected]' }], url: 'https://meet.google.com/fak-eeve-ntx', calendarId: 'work', calendar: 'Work', calendarSource: '[email protected]' }]
+ attendees: [{ name: 'Jamie Quill', email: '[email protected]' }], url: 'https://meet.google.com/fak-eeve-ntx', calendarId: 'work', calendar: 'Work', calendarSource: '[email protected]', me: '[email protected]' }]
const next = new Date(meeting.startedAt); next.setDate(next.getDate() + 1)
events.push({ ...events[0], id: 'next-day-event', title: 'Next day review', start: next.toISOString(), end: new Date(+next + 1_800_000).toISOString() })
await app.evaluate((_e, events) => (globalThis as unknown as { __fake__: { calendarEvents(events: unknown[]): void } }).__fake__.calendarEvents(events), events)
@@ -109,9 +109,10 @@ for (const theme of ['light', 'dark'] as const) test(`split metadata popovers st
await page.getByTestId('note-attendees').click()
await expect(date).toHaveCount(0)
const people = page.getByTestId('people-card')
- await expect(people.getByTestId('people-email')).toHaveText('[email protected]')
+ await expect(people.getByTestId('people-email')).toHaveText(['[email protected]', '[email protected]'])
+ await expect(people.locator('[data-me]')).toContainText('[email protected]')
await expect(people.getByRole('heading', { name: 'Example', exact: true })).toBeVisible()
- await expect(people.getByRole('heading', { name: 'Other people', exact: true })).toBeVisible()
+ await expect(people.getByRole('heading', { name: 'Other people', exact: true })).toHaveCount(0)
await expect(people.locator('.person-initials')).toHaveCount(2)
await expect(people).not.toContainText('Planning with Jamie')
// a mouse-opened card shows no row actions until hovered or reached by keyboard
diff --git a/app/src/main/backup.ts b/app/src/main/backup.ts
index b8fb0b03..faf011ec 100644
--- a/app/src/main/backup.ts
+++ b/app/src/main/backup.ts
@@ -1,6 +1,7 @@
import { migrateMeetingChats } from './library/store'
import backupFormat from '../shared/backupFormat.json'
import { backfillPeople, mergePeople } from './people'
+import { ownAddress } from '../shared/people'
import { constants, existsSync } from 'node:fs'
import { cp, lstat, mkdir, mkdtemp, readFile, rename, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
@@ -91,7 +92,7 @@ export function mergeBackup(into: DatabaseSync, from: DatabaseSync): { added: st
const { add, skipped } = newIds(into, from)
const chats = newIds(into, from, 'conversations').add
const folders = tables(from).has('folder_meetings') ? newIds(into, from, 'folders').add : []
- if (!add.length && !chats.length && !folders.length && !tables(from).has('people')) return { added: [], skipped }
+ if (!add.length && !chats.length && !folders.length && !tables(from).has('people') && !tables(from).has('own_emails')) return { added: [], skipped }
// a backup from when voices had letters (Speaker A, B): those lines come in as Them, as this database's own did
const lettered = tables(from).has('speakers')
const plan = plans(into, from, [{ table: 'meetings', column: 'id' }, ...meetingTables(into)])
@@ -123,6 +124,13 @@ export function mergeBackup(into: DatabaseSync, from: DatabaseSync): { added: st
for (const r of from.prepare('SELECT meeting_id, added_at FROM folder_meetings WHERE folder_id = ?').all(fid) as Row[]) link.run(fid, r.meeting_id, r.added_at, r.meeting_id)
}
migrateMeetingChats(into)
+ if (tables(from).has('own_emails')) {
+ const save = into.prepare('INSERT OR IGNORE INTO own_emails (email) VALUES (?)')
+ for (const row of from.prepare('SELECT email FROM own_emails').all()) {
+ const email = ownAddress(row.email)
+ if (email) save.run(email)
+ }
+ }
mergePeople(into, from)
backfillPeople(into)
into.exec('COMMIT')
diff --git a/app/src/main/calendar.ts b/app/src/main/calendar.ts
index a0057910..824c418b 100644
--- a/app/src/main/calendar.ts
+++ b/app/src/main/calendar.ts
@@ -5,9 +5,10 @@ import { helperFile } from '../shared/platform'
import type { Person } from './store'
import type { Settings } from './settings'
import { noteOwnEmail } from './vocab'
+import { ownAddress } from '../shared/people'
/** One meeting on the calendar, times in ms */
-export type CalEvent = { id: string; title: string; start: number; end: number; attendees: Person[]; url: string | null; calendar?: CalendarSource; aliases?: string[] }
+export type CalEvent = { id: string; title: string; start: number; end: number; attendees: Person[]; url: string | null; calendar?: CalendarSource; aliases?: string[]; ownEmail?: string | null }
export type CalendarSource = { id: string; name: string; source: string; color?: string }
export const eventIds = (event: CalEvent): string[] => [event.id, ...(event.aliases ?? [])]
export const matchesEvent = (event: CalEvent, id: string | null): boolean => !!id && eventIds(event).includes(id)
@@ -106,6 +107,8 @@ export const meetingLink = (text: string | undefined | null): string | null => t
const str = (v: unknown) => (typeof v === 'string' && v ? v : null)
let calendarSelection = (): Pick<Settings, 'hiddenCalendarIds' | 'hideEventsWithoutCallLink'> => ({})
+let rememberOwnEmail = (_email: string) => {}
+export const setCalendarOwnEmail = (remember: typeof rememberOwnEmail) => { rememberOwnEmail = remember }
export const setCalendarSelection = (read: typeof calendarSelection) => { calendarSelection = read }
export async function calendars(): Promise<CalendarSource[]> {
@@ -127,9 +130,10 @@ export function parseEvents(raw: unknown, hidden: string[] = []): CalEvent[] {
if (!r || typeof r !== 'object') continue
const id = str(r.id), start = Date.parse(String(r.start)), end = Date.parse(String(r.end))
// the helper leaves the person using this Mac out of the attendees, and gives their address on its own
- noteOwnEmail(str(r.me))
+ const ownEmail = ownAddress(r.me)
// a meeting shared onto a second calendar comes twice with the same id; once is enough, and the list needs ids to be unique
if (!id || Number.isNaN(start) || Number.isNaN(end)) continue
+ if (ownEmail) { noteOwnEmail(ownEmail); rememberOwnEmail(ownEmail) }
const attendees = (Array.isArray(r.attendees) ? r.attendees : []).flatMap((a: Record<string, unknown>) => {
const name = str(a?.name), email = str(a?.email)
return name || email ? [{ name: name ?? email!, email }] : []
@@ -139,7 +143,7 @@ export function parseEvents(raw: unknown, hidden: string[] = []): CalEvent[] {
const key = identity ? JSON.stringify([identity, start, end]) : id
const copies = groups.get(key) ?? []
copies.push({
- id, title: str(r.title) ?? '', start, end, attendees,
+ id, ...(ownEmail ? { ownEmail } : {}), title: str(r.title) ?? '', start, end, attendees,
url: meetingLink(str(r.url)) ?? meetingLink(str(r.location)) ?? meetingLink(str(r.notes)),
...(calendarId ? { calendar: { id: calendarId, name: str(r.calendar) ?? '', source: str(r.calendarSource) ?? '' } } : {}),
})
diff --git a/app/src/main/index.ts b/app/src/main/index.ts
index 42b5144e..83e76a10 100644
--- a/app/src/main/index.ts
+++ b/app/src/main/index.ts
@@ -40,7 +40,7 @@ import { SetupController } from './setup'
import { fakeMeasure, measureSpeed, speedClipPath, speedStore } from './asr/speedCheck'
import { vadModelPath, whisperServerPath } from './asr/server'
import { openStore, type Store } from './store'
-import { calendars, eventIds, matchesEvent, setCalendarSelection, calendarStatus, createHelperRunner, helperPath, killAllHelpers, refreshCalendarStatus, requestCalendarAccess, runHelper, setCalendarLinkSource, systemCalendarStatus, setCalendarSupported, setHelper, upcoming, type CalEvent } from './calendar'
+import { calendars, eventIds, matchesEvent, setCalendarSelection, setCalendarOwnEmail, calendarStatus, createHelperRunner, helperPath, killAllHelpers, refreshCalendarStatus, requestCalendarAccess, runHelper, setCalendarLinkSource, systemCalendarStatus, setCalendarSupported, setHelper, upcoming, type CalEvent } from './calendar'
import { createCalendarLinks } from './calendarLink'
import { getCalendar } from './calendarLink/get'
import { createSignals } from './detectSignals'
@@ -530,6 +530,10 @@ app.whenReady().then(() => {
// the person's own names, never given to the other side: the one in Settings and the Mac's
const settingsFile = join(userDataDir(), 'settings.json')
setCalendarSelection(() => loadSettings(settingsFile))
+ setCalendarOwnEmail(email => {
+ try { if (store.rememberOwnEmail(email)) win?.webContents.send('meetings:changed') }
+ catch (e) { console.warn('could not save own calendar address', e) }
+ })
const me = () => loadSettings(settingsFile).myName?.trim() || macName()
setOwnerName(me)
setJargon(() => cleanJargon(loadSettings(settingsFile).jargon))
diff --git a/app/src/main/meeting.ts b/app/src/main/meeting.ts
index 02b5d546..f70dc190 100644
--- a/app/src/main/meeting.ts
+++ b/app/src/main/meeting.ts
@@ -65,7 +65,7 @@ export function startMeeting(p: { title: string; event: CalEvent | null; app: st
const title = p.title || t('Meeting')
const m = store.createMeeting({
title, titleSource: sourceOf(title, p.event?.id ?? null), startedAt: Date.now(), endedAt: null, eventId: p.event?.id ?? null,
- ...(p.event ? { eventStartedAt: p.event.start, eventEndedAt: p.event.end, eventTitle: p.event.title,
+ ...(p.event ? { eventStartedAt: p.event.start, eventEndedAt: p.event.end, eventTitle: p.event.title, ownEmail: p.event.ownEmail ?? null,
...(p.event.calendar ? { eventCalendarName: p.event.calendar.name, eventCalendarSource: p.event.calendar.source } : {}) } : {}),
app: p.app, attendees: p.event?.attendees ?? [], state: 'recording',
})
@@ -90,7 +90,7 @@ export function prepareMeeting(event: CalEvent): Meeting {
if (existing) { refreshEventSnapshots([event]); return store.meeting(existing.id)! }
const m = store.createMeeting({
title: event.title || t('Meeting'), titleSource: 'calendar', startedAt: event.start, endedAt: null,
- eventId: event.id, eventStartedAt: event.start, eventEndedAt: event.end, eventTitle: event.title,
+ eventId: event.id, eventStartedAt: event.start, eventEndedAt: event.end, eventTitle: event.title, ownEmail: event.ownEmail ?? null,
...(event.calendar ? { eventCalendarName: event.calendar.name, eventCalendarSource: event.calendar.source } : {}), app: null, attendees: event.attendees, state: 'prepared',
})
store.markPrepared(m.id, event.end)
@@ -204,7 +204,7 @@ export function linkEvent(id: string, event: CalEvent): Meeting | undefined {
const meeting = store?.meeting(id)
if (!store || !meeting) return undefined
if (meeting.state === 'prepared') store.markPrepared(id, event.end)
- return update(id, { eventId: event.id, eventStartedAt: event.start, eventEndedAt: event.end, eventTitle: event.title, eventCalendarName: event.calendar?.name ?? null, eventCalendarSource: event.calendar?.source ?? null, title: event.title || meeting.title, ...(event.title ? { titleSource: 'calendar' as const } : {}), attendees: event.attendees })
+ return update(id, { eventId: event.id, eventStartedAt: event.start, eventEndedAt: event.end, eventTitle: event.title, ownEmail: event.ownEmail ?? null, eventCalendarName: event.calendar?.name ?? null, eventCalendarSource: event.calendar?.source ?? null, title: event.title || meeting.title, ...(event.title ? { titleSource: 'calendar' as const } : {}), attendees: event.attendees })
}
/** Reading a calendar updates its snapshot, never the person's title, attendees or notes. */
@@ -223,7 +223,7 @@ export function refreshEventSnapshots(events: CalEvent[]) {
/** Remove only the calendar association; the title, people and notes belong to the person now. */
export function unlinkEvent(id: string): Meeting | undefined {
if (!store || !store.meeting(id)) return undefined
- return update(id, { eventId: null, eventStartedAt: null, eventEndedAt: null, eventTitle: null, eventCalendarName: null, eventCalendarSource: null })
+ return update(id, { eventId: null, eventStartedAt: null, eventEndedAt: null, eventTitle: null, eventCalendarName: null, eventCalendarSource: null, ownEmail: null })
}
function update(id: string, patch: Partial<Omit<Meeting, 'id'>>): Meeting {
diff --git a/app/src/main/store.ts b/app/src/main/store.ts
index 59f54ffd..7e638a2b 100644
--- a/app/src/main/store.ts
+++ b/app/src/main/store.ts
@@ -3,7 +3,7 @@ import { matchSearchPeople, searchPersonKey, uniqueSearchPeople } from '../share
import { oneEdit, parseSearchQuery, type SearchOptions } from '../shared/searchQuery'
import { echoConfidence } from './asr/echo'
import { backfillPeople, rememberPeople, resolvePeople } from './people'
-import { attendeeMembership, personEmail } from '../shared/people'
+import { attendeeMembership, matchingOwnEmail, ownAddress, personEmail } from '../shared/people'
import type { FolderSuggestionRecord } from '../shared/folderSuggestion'
import { unusedPreparedNote } from '../shared/agendaNote'
import { speakerOrder } from '../shared/speakerColors'
@@ -25,6 +25,8 @@ export type Meeting = {
eventTitle?: string | null
eventCalendarName?: string | null
eventCalendarSource?: string | null
+ /** The event address, or a known own address matching an attendee on an unlinked note. */
+ ownEmail?: string | null
source?: string
sourceId?: string
app: string | null; attendees: Person[]; state: 'prepared' | 'recording' | 'stopped' | 'done'
@@ -57,6 +59,7 @@ const toMeeting = (r: Row): Meeting => ({
titleSource: (r.title_source ?? 'user') as TitleSource,
...(r.source == null ? {} : { source: String(r.source) }),
...(r.source_id == null ? {} : { sourceId: String(r.source_id) }),
+ ...(r.own_email == null ? {} : { ownEmail: String(r.own_email) }),
...(r.event_started_at == null ? {} : { eventStartedAt: Number(r.event_started_at) }),
...(r.event_ended_at == null ? {} : { eventEndedAt: Number(r.event_ended_at) }),
...(r.event_title == null ? {} : { eventTitle: String(r.event_title) }),
@@ -152,6 +155,7 @@ export class Store {
this.db.exec(`
PRAGMA journal_mode = WAL;
PRAGMA foreign_keys = ON;
+ CREATE TABLE IF NOT EXISTS own_emails (email TEXT PRIMARY KEY);
CREATE TABLE IF NOT EXISTS meetings (
id TEXT PRIMARY KEY, title TEXT NOT NULL, started_at INTEGER NOT NULL, ended_at INTEGER, event_id TEXT, app TEXT,
attendees TEXT NOT NULL DEFAULT '[]', state TEXT NOT NULL, language TEXT);
@@ -206,7 +210,7 @@ export class Store {
if (!meetingCols.includes('last_opened_at')) this.db.exec('ALTER TABLE meetings ADD COLUMN last_opened_at INTEGER')
if (!meetingCols.includes('speaker_order')) this.db.exec("ALTER TABLE meetings ADD COLUMN speaker_order TEXT NOT NULL DEFAULT '[]'")
for (const name of ['source', 'source_id']) if (!meetingCols.includes(name)) this.db.exec(`ALTER TABLE meetings ADD COLUMN ${name} TEXT`)
- for (const [name, type] of [['event_ended_at', 'INTEGER'], ['event_title', 'TEXT'], ['event_calendar_name', 'TEXT'], ['event_calendar_source', 'TEXT']]) {
+ for (const [name, type] of [['event_ended_at', 'INTEGER'], ['event_title', 'TEXT'], ['event_calendar_name', 'TEXT'], ['event_calendar_source', 'TEXT'], ['own_email', 'TEXT']]) {
if (!meetingCols.includes(name)) this.db.exec(`ALTER TABLE meetings ADD COLUMN ${name} ${type}`)
}
if (!meetingCols.includes('event_started_at')) this.db.exec('ALTER TABLE meetings ADD COLUMN event_started_at INTEGER')
@@ -264,8 +268,9 @@ export class Store {
}
}
private readMeeting(r: Row): Meeting {
- const m = toMeeting(r)
- return { ...m, attendees: resolvePeople(this.db, m.attendees) }
+ const { ownEmail: savedOwnEmail, ...m } = toMeeting(r)
+ const ownEmail = m.eventId ? ownAddress(savedOwnEmail) : matchingOwnEmail(m.attendees, this.ownEmails())
+ return { ...m, ...(ownEmail ? { ownEmail } : {}), attendees: resolvePeople(this.db, m.attendees) }
}
renameAttendee(id: string, index: number, raw: string): boolean {
const name = raw.replace(/\s+/g, ' ').trim().slice(0, 200)
@@ -288,20 +293,30 @@ export class Store {
return true
} catch (e) { this.db.exec('ROLLBACK TO rename_person; RELEASE rename_person'); throw e }
}
+ ownEmails(): string[] {
+ return this.db.prepare('SELECT email FROM own_emails ORDER BY email').all().map(r => String(r.email))
+ }
+ rememberOwnEmail(value: string | null | undefined) {
+ const email = ownAddress(value)
+ return !!email && this.db.prepare('INSERT OR IGNORE INTO own_emails (email) VALUES (?)').run(email).changes > 0
+ }
close() { this.db.close() }
createMeeting(m: Omit<Meeting, 'id' | 'language' | 'titleSource'> & { language?: string | null; titleSource?: TitleSource }): Meeting {
const id = randomUUID()
const language = m.language ?? null
+ const ownEmail = m.eventId ? ownAddress(m.ownEmail) : null
+ this.rememberOwnEmail(ownEmail)
const titleSource = m.titleSource ?? sourceOf(m.title, m.eventId)
- this.db.prepare('INSERT INTO meetings (id, title, started_at, ended_at, event_id, app, attendees, state, language, title_source, duration_ms, event_started_at, event_ended_at, event_title, event_calendar_name, event_calendar_source) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)')
- .run(id, m.title, m.startedAt, m.endedAt, m.eventId, m.app, JSON.stringify(m.attendees), m.state, language, titleSource, m.durationMs ?? null, m.eventStartedAt ?? null, m.eventEndedAt ?? null, m.eventTitle ?? null, m.eventCalendarName ?? null, m.eventCalendarSource ?? null)
+ this.db.prepare('INSERT INTO meetings (id, title, started_at, ended_at, event_id, app, attendees, state, language, title_source, duration_ms, event_started_at, event_ended_at, event_title, event_calendar_name, event_calendar_source, own_email) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)')
+ .run(id, m.title, m.startedAt, m.endedAt, m.eventId, m.app, JSON.stringify(m.attendees), m.state, language, titleSource, m.durationMs ?? null, m.eventStartedAt ?? null, m.eventEndedAt ?? null, m.eventTitle ?? null, m.eventCalendarName ?? null, m.eventCalendarSource ?? null, ownEmail)
rememberPeople(this.db, m.attendees)
- return { ...m, id, language, titleSource, attendees: resolvePeople(this.db, m.attendees) }
+ return this.meeting(id)!
}
updateMeeting(id: string, patch: Partial<Omit<Meeting, 'id'>>) {
+ if (patch.ownEmail) this.rememberOwnEmail(patch.ownEmail)
if (patch.attendees) rememberPeople(this.db, patch.attendees)
- const col: Record<string, string> = { title: 'title', startedAt: 'started_at', endedAt: 'ended_at', eventId: 'event_id', eventStartedAt: 'event_started_at', eventEndedAt: 'event_ended_at', eventTitle: 'event_title', eventCalendarName: 'event_calendar_name', eventCalendarSource: 'event_calendar_source', app: 'app', attendees: 'attendees', state: 'state', language: 'language', titleSource: 'title_source', durationMs: 'duration_ms', transcriptionPending: 'transcription_pending' }
+ const col: Record<string, string> = { title: 'title', startedAt: 'started_at', endedAt: 'ended_at', eventId: 'event_id', eventStartedAt: 'event_started_at', eventEndedAt: 'event_ended_at', eventTitle: 'event_title', eventCalendarName: 'event_calendar_name', eventCalendarSource: 'event_calendar_source', ownEmail: 'own_email', app: 'app', attendees: 'attendees', state: 'state', language: 'language', titleSource: 'title_source', durationMs: 'duration_ms', transcriptionPending: 'transcription_pending' }
const keys = Object.keys(patch).filter((k) => k in col && (patch as Row)[k] !== undefined)
if (!keys.length) return
const vals = keys.map((k) => (k === 'attendees' ? JSON.stringify(patch.attendees) : k === 'transcriptionPending' ? Number(patch.transcriptionPending) : (patch as Row)[k]) as string | number | null)
@@ -309,9 +324,10 @@ export class Store {
}
/** Refresh every note still linked to this occurrence, including alternate calendar IDs. */
rememberEvent(event: CalEvent): Meeting[] {
+ this.rememberOwnEmail(event.ownEmail)
const ids = eventIds(event)
- const values = [event.start, event.end, event.title, event.calendar?.name ?? null, event.calendar?.source ?? null]
- const columns = ['event_started_at', 'event_ended_at', 'event_title', 'event_calendar_name', 'event_calendar_source']
+ const values = [event.start, event.end, event.title, event.calendar?.name ?? null, event.calendar?.source ?? null, ownAddress(event.ownEmail)]
+ const columns = ['event_started_at', 'event_ended_at', 'event_title', 'event_calendar_name', 'event_calendar_source', 'own_email']
const rows = this.db.prepare(`UPDATE meetings SET ${columns.map(c => `${c} = ?`).join(', ')}
WHERE event_id IN (${ids.map(() => '?').join(', ')}) AND (${columns.map(c => `${c} IS NOT ?`).join(' OR ')}) RETURNING *`)
.all(...values, ...ids, ...values) as Row[]
diff --git a/app/src/renderer/src/components/People.tsx b/app/src/renderer/src/components/People.tsx
index 732a8c15..9144e93e 100644
--- a/app/src/renderer/src/components/People.tsx
+++ b/app/src/renderer/src/components/People.tsx
@@ -1,6 +1,6 @@
import { attendeeSuggestions, searchPersonKey } from '../../../shared/searchPeople'
import { usePopoverPresence } from '../motion'
-import { attendeePrivacy, emailName, groupPeople, initials } from '../../../shared/people'
+import { attendeePrivacy, emailName, groupPeople, initials, personEmail } from '../../../shared/people'
import { toasts } from './TrashToast'
import { useCallback, useEffect, useId, useRef, useState, type KeyboardEvent, type RefObject } from 'react'
import { useNotePopover } from '../useNotePopover'
@@ -109,9 +109,9 @@ function Card({ m, me, motionProps, chip, onClose }: { m: Meeting; me: string; m
if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); onClose() }
}
// Keep original attendee indices when grouping; an invite lists the person themself once.
- const others = m.attendees.map((p, i) => ({ p, i })).filter(({ p }) => !same(p.name, me))
+ const others = m.attendees.map((p, i) => ({ p, i })).filter(({ p }) => m.ownEmail && p.email ? personEmail(p.email) !== personEmail(m.ownEmail) : !same(p.name, me))
- const groups = groupPeople<{ p: Person; i: number; mine?: boolean }>([{ p: { name: me || t('Me'), email: m.attendees.find(p => same(p.name, me))?.email ?? null }, i: -1, mine: true }, ...others])
+ const groups = groupPeople<{ p: Person; i: number; mine?: boolean }>([{ p: { name: me || t('Me'), email: m.ownEmail ?? null }, i: -1, mine: true }, ...others])
return (
<div ref={card} data-testid="people-card" {...motionProps} data-anchor="start" role="dialog" aria-label={t('People')} onKeyDown={key}
diff --git a/app/src/shared/people.ts b/app/src/shared/people.ts
index 055cb01b..d25da2ea 100644
--- a/app/src/shared/people.ts
+++ b/app/src/shared/people.ts
@@ -1,4 +1,11 @@
import type { Person } from './types'
+export const ownAddress = (value: unknown): string | null => typeof value === 'string' && /^[^\s<>@]+@[^\s<>@]+\.[^\s<>@]+$/.test(value.trim()) ? value.trim().toLowerCase() : null
+/** Only an address already identified as ours can fill an unlinked note's self row. */
+export function matchingOwnEmail(people: Person[], emails: string[]): string | null {
+ const domains = new Set(people.map(p => ownAddress(p.email)?.split('@')[1]).filter(Boolean))
+ return emails.map(ownAddress).filter((email): email is string => !!email).sort().find(email => domains.has(email.split('@')[1])) ?? null
+}
+
export const personEmail = (email: string) => email.trim().toLowerCase()
export const attendeePrivacy = (focused: boolean, text: string) => focused || text.includes('@')
export const attendeeMembership = (people: Person[]) => 'members:' + JSON.stringify(people.map(p => p.email ? `email:${personEmail(p.email)}` : `name:${p.name}`).sort())
diff --git a/app/test/backup.test.ts b/app/test/backup.test.ts
index 3d8758ae..bdcec4e7 100644
--- a/app/test/backup.test.ts
+++ b/app/test/backup.test.ts
@@ -143,8 +143,8 @@ describe('backup merge', () => {
expect(meetingTables(s.db).map((t) => t.table).sort()).toEqual(['chat_turns', 'folder_meetings', 'library_chunks', 'library_sources', 'notes', 'segments'])
// a new table that is not tied to a meeting would be left out of backups: decide what a backup does with it, then list it here
const all = (s.db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' AND name NOT LIKE '%_fts%'").all() as Array<{ name: string }>).map((r) => r.name)
- expect(all.filter((t) => t !== 'meetings' && !meetingTables(s.db).some((m) => m.table === t)).sort()).toEqual(['conversation_turns', 'conversations', 'folders', 'people'])
- // those are carried on their own: a conversation and every turn of it, and folders (test/folders.test.ts)
+ expect(all.filter((t) => t !== 'meetings' && !meetingTables(s.db).some((m) => m.table === t)).sort()).toEqual(['conversation_turns', 'conversations', 'folders', 'own_emails', 'people'])
+ // Own addresses merge by email, like the people records. The remaining tables are carried on their own: a conversation and every turn of it, and folders (test/folders.test.ts)
expect(carriedTables(s.db)).toEqual([{ table: 'conversations', column: 'id' }, { table: 'conversation_turns', column: 'conversation_id' }, { table: 'folders', column: 'id' }])
})
diff --git a/app/test/ownEmail.test.ts b/app/test/ownEmail.test.ts
new file mode 100644
index 00000000..d4980807
--- /dev/null
+++ b/app/test/ownEmail.test.ts
@@ -0,0 +1,75 @@
+import { mkdtempSync, rmSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { afterEach, expect, it } from 'vitest'
+import { openStore } from '../src/main/store'
+import { parseEvents, setCalendarOwnEmail } from '../src/main/calendar'
+import { initMeetings, linkEvent, prepareMeeting, refreshEventSnapshots, startMeeting, stopMeeting, unlinkEvent } from '../src/main/meeting'
+import { mergeBackup } from '../src/main/backup'
+import { groupPeople, matchingOwnEmail, ownAddress } from '../src/shared/people'
+
+const people = [{ name: 'Attendee One', email: '[email protected]' }, { name: 'Attendee Two', email: '[email protected]' }]
+const note = { title: 'Planning', startedAt: 1, endedAt: 2, eventId: null, app: null, attendees: people, state: 'done' as const }
+const event = { id: 'invite', title: 'Planning', start: 1, end: 2, attendees: people, url: null, ownEmail: '[email protected]' }
+afterEach(() => setCalendarOwnEmail(() => {}))
+
+it('uses only a valid, known own address with an exact matching attendee domain', () => {
+ expect(matchingOwnEmail(people, ['[email protected]', '[email protected]'])).toBe('[email protected]')
+ expect(matchingOwnEmail(people, ['[email protected]', '[email protected]'])).toBeNull()
+ expect(matchingOwnEmail(people, [])).toBeNull()
+ expect(matchingOwnEmail([], ['[email protected]'])).toBeNull()
+ expect(matchingOwnEmail(people, ['[email protected]', '[email protected]'])).toBe('[email protected]')
+ for (const value of [null, {}, '', 'not-email', 'two@@studio.example', 'two@studio', 'two [email protected]']) expect(ownAddress(value)).toBeNull()
+})
+
+it('keeps the helper own address on its event without adding it to attendees', () => {
+ const known: string[] = []
+ setCalendarOwnEmail(email => { known.push(email) })
+ const row = { id: 'event', start: '2026-11-01T10:00:00Z', end: '2026-11-01T11:00:00Z', me: ' [email protected] ', attendees: people }
+ expect(parseEvents([row])[0]).toMatchObject({ ownEmail: '[email protected]', attendees: people })
+ expect(known).toEqual(['[email protected]'])
+ expect(parseEvents([{ ...row, me: 'bad' }])[0].ownEmail).toBeUndefined()
+ parseEvents([{ me: '[email protected]' }]); expect(known).toEqual(['[email protected]'])
+})
+
+it('saves the event address for prepared, started and later-linked notes, and refreshes old snapshots', () => {
+ const store = openStore(':memory:'); initMeetings(store)
+ try {
+ const prepared = prepareMeeting(event)
+ expect(prepared.ownEmail).toBe(event.ownEmail)
+ const started = startMeeting({ title: 'Planning', app: null, event: { ...event, id: 'other' } })
+ expect(started.ownEmail).toBe(event.ownEmail); stopMeeting(started.id)
+ const m = store.createMeeting(note)
+ expect(linkEvent(m.id, { ...event, ownEmail: '[email protected]' })?.ownEmail).toBe('[email protected]')
+ expect(unlinkEvent(m.id)?.ownEmail).toBe('[email protected]')
+ store.updateMeeting(m.id, { attendees: [{ name: 'Visitor', email: '[email protected]' }] })
+ expect(store.meeting(m.id)?.ownEmail).toBeUndefined()
+ const old = store.createMeeting({ ...note, eventId: event.id })
+ expect(old.ownEmail).toBeUndefined()
+ refreshEventSnapshots([event])
+ expect(store.meeting(old.id)?.ownEmail).toBe(event.ownEmail)
+ expect(store.meeting(old.id)?.attendees).toEqual(people)
+ refreshEventSnapshots([]); expect(store.meeting(old.id)?.ownEmail).toBe(event.ownEmail)
+ const rows = [{ p: { name: 'Sample Self', email: store.meeting(old.id)!.ownEmail! }, mine: true }, ...people.map(p => ({ p }))]
+ expect(groupPeople(rows).find(g => g.domain === 'studio.example')?.people).toEqual([rows[0], rows[1]])
+ } finally { store.close() }
+})
+
+it('retains event and fallback addresses after reopening without calendar access, and merges them in backups', () => {
+ const dir = mkdtempSync(join(tmpdir(), 'yogurt-own-')), file = join(dir, 'notes.db')
+ let store = openStore(file)
+ const into = openStore(':memory:')
+ try {
+ const linked = store.createMeeting({ ...note, eventId: event.id, ownEmail: event.ownEmail })
+ const unlinked = store.createMeeting(note)
+ store.rememberOwnEmail('[email protected]')
+ store.close(); store = openStore(file)
+ expect(store.meeting(linked.id)?.ownEmail).toBe(event.ownEmail)
+ expect(store.meeting(unlinked.id)?.ownEmail).toBe('[email protected]')
+ into.rememberOwnEmail('[email protected]')
+ mergeBackup(into.db, store.db)
+ expect(into.meeting(linked.id)?.ownEmail).toBe(event.ownEmail)
+ expect(into.meeting(unlinked.id)?.ownEmail).toBe('[email protected]')
+ expect(into.ownEmails()).toEqual(['[email protected]', '[email protected]', '[email protected]'])
+ } finally { store.close(); into.close(); rmSync(dir, { recursive: true, force: true }) }
+})
diff --git a/app/test/peopleCard.test.ts b/app/test/peopleCard.test.ts
index cb31d8c6..86bc976e 100644
--- a/app/test/peopleCard.test.ts
+++ b/app/test/peopleCard.test.ts
@@ -19,12 +19,12 @@ function nodes(tree: any): any[] {
return [tree, ...[tree.props?.children].flat(Infinity).flatMap(nodes)]
}
const attendees = [{ name: 'Attendee One', email: '[email protected]' }, { name: 'Attendee Two', email: '[email protected]' }, { name: 'Self', email: '[email protected]' }]
-const meeting = { id: 'note', attendees, startedAt: 1 } as Meeting
-function setup() {
+const meeting = { id: 'note', attendees, startedAt: 1, ownEmail: '[email protected]' } as Meeting
+function setup(m: Meeting = meeting) {
const renameAttendee = vi.fn().mockResolvedValue(true), setAttendees = vi.fn().mockResolvedValue(undefined)
vi.stubGlobal('window', { yogurt: { meetings: { renameAttendee, setAttendees } } })
hooks.values = [false, 'Self']; hooks.index = 0
- const root = People({ m: meeting }) as any
+ const root = People({ m }) as any
const element = root.props.children[1]
hooks.values = []; hooks.index = 0
const close = vi.fn()
@@ -56,3 +56,19 @@ it('retains keyboard entry for adding attendees and Escape dismissal', async ()
render().props.onKeyDown({ key: 'Escape', preventDefault: vi.fn(), stopPropagation: vi.fn() })
expect(close).toHaveBeenCalledOnce()
})
+it('groups the self row by the saved event address, even with no attendee of the same name', () => {
+ const m = { ...meeting, ownEmail: '[email protected]', attendees: attendees.slice(0, 2) }
+ const { render } = setup(m)
+ const groups = nodes(render()).filter(n => n.type === 'section')
+ const alpha = groups.find(g => g.props['aria-label'] === 'Alpha')
+ const rows = nodes(alpha).filter(n => n.type?.name === 'Row')
+ expect(rows.map(r => r.props.email)).toEqual(['[email protected]', '[email protected]'])
+ expect(rows[0].props.mine).toBe(true)
+ expect(rows[0].props.onRename).toBeUndefined(); expect(rows[0].props.onRemove).toBeUndefined()
+})
+it('does not invent the self address from a matching name and retains another person with the same name', () => {
+ const { render } = setup({ ...meeting, ownEmail: undefined })
+ expect(nodes(render()).find(n => n.type?.name === 'Row' && n.props.mine).props.email).toBeNull()
+ const other = setup({ ...meeting, ownEmail: '[email protected]' })
+ expect(nodes(other.render()).filter(n => n.type?.name === 'Row' && n.props.name === 'Self')).toHaveLength(2)
+})