Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

feat(meeting): adopt active calendar event when recording in an unclaimed note

Gabriel Steind5082a22e457
diff --git a/src/helpers/database.js b/src/helpers/database.js
index f2098838c..c8a1d901b 100644
--- a/src/helpers/database.js
+++ b/src/helpers/database.js
@@ -1435,6 +1435,24 @@ class DatabaseManager {
}
}
+ getNoteByCalendarEventId(eventId, excludeNoteId = null) {
+ try {
+ if (!this.db) throw new Error("Database not initialized");
+ const base = "SELECT * FROM notes WHERE calendar_event_id = ? AND deleted_at IS NULL";
+ if (excludeNoteId) {
+ return this.db.prepare(`${base} AND id != ? LIMIT 1`).get(eventId, excludeNoteId) || null;
+ }
+ return this.db.prepare(`${base} LIMIT 1`).get(eventId) || null;
+ } catch (error) {
+ debugLogger.error(
+ "Error getting note by calendar event id",
+ { error: error.message },
+ "notes"
+ );
+ return null;
+ }
+ }
+
upsertContacts(contacts) {
try {
if (!this.db) throw new Error("Database not initialized");
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 1e472cbf0..7be8a1dc2 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -4012,6 +4012,35 @@ class IPCHandlers {
}
};
+ const adoptActiveCalendarEventForNote = (noteId) => {
+ if (!noteId) return;
+ try {
+ const note = this.databaseManager.getNote(noteId);
+ if (!note || note.participants || note.calendar_event_id) return;
+
+ const events = this.databaseManager.getActiveEvents();
+ for (const evt of events) {
+ if (!evt.attendees) continue;
+ if (!this._resolveOneOnOneOtherParticipant(evt.attendees)) continue;
+ if (this.databaseManager.getNoteByCalendarEventId(evt.id, noteId)) continue;
+
+ this.databaseManager.updateNote(noteId, {
+ calendar_event_id: evt.id,
+ participants: evt.attendees,
+ });
+ const updated = this.databaseManager.getNote(noteId);
+ if (updated) this.broadcastToWindows("note-updated", updated);
+ return;
+ }
+ } catch (error) {
+ debugLogger.warn(
+ "Adopt active calendar event failed",
+ { noteId, error: error.message },
+ "meeting"
+ );
+ }
+ };
+
const bindOneOnOneAttendeeToSpeaker = (speakerId) => {
if (!meetingOneOnOneAttendee || meetingOneOnOneProfileBound || !speakerId) return;
const embedding = liveSpeakerIdentifier.getSpeakerEmbedding(speakerId);
@@ -4701,6 +4730,7 @@ class IPCHandlers {
const systemAudioPlan = await getMeetingSystemAudioPlan();
let { mode: systemAudioMode, strategy: systemAudioStrategy } = systemAudioPlan;
meetingEchoLeakDetector.reset();
+ adoptActiveCalendarEventForNote(options.noteId);
meetingOneOnOneAttendee = resolveOneOnOneAttendeeForNote(options.noteId);
meetingOneOnOneProfileBound = false;