Skip to content

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

fix(notes): broadcast calendar attendees to store and stabilize participant saves

Gabriel Stein3b3908726fac
diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsx
index b3dc1ce3a..db3f1c6d4 100644
--- a/src/components/notes/NoteEditor.tsx
+++ b/src/components/notes/NoteEditor.tsx
@@ -339,14 +339,7 @@ export default function NoteEditor({
<span className="truncate max-w-40">{calendarEventName}</span>
</span>
)}
- <NoteParticipants
- participants={parsedParticipants}
- onUpdate={async (updated) => {
- await window.electronAPI.updateNote(note.id, {
- participants: JSON.stringify(updated),
- });
- }}
- />
+ <NoteParticipants noteId={note.id} participants={parsedParticipants} />
{folders && onMoveToFolder && (
<DropdownMenu
onOpenChange={(open) => {
diff --git a/src/components/notes/NoteParticipants.tsx b/src/components/notes/NoteParticipants.tsx
index ef02c8a3f..ba7d08e0f 100644
--- a/src/components/notes/NoteParticipants.tsx
+++ b/src/components/notes/NoteParticipants.tsx
@@ -18,12 +18,48 @@ function getInitialColor(email: string): string {
return `hsl(${h}, 45%, 65%)`;
}
+interface ParticipantAvatarProps {
+ email: string;
+ displayName: string | null;
+ gravatarHash?: string;
+ failed: boolean;
+ onImageError: () => void;
+}
+
+function ParticipantAvatar({
+ email,
+ displayName,
+ gravatarHash,
+ failed,
+ onImageError,
+}: ParticipantAvatarProps) {
+ if (gravatarHash && !failed) {
+ return (
+ <img
+ src={`https://www.gravatar.com/avatar/${gravatarHash}?d=404&s=64`}
+ alt=""
+ loading="lazy"
+ className="shrink-0 w-6 h-6 rounded-full object-cover"
+ onError={onImageError}
+ />
+ );
+ }
+ return (
+ <span
+ className="shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white"
+ style={{ backgroundColor: getInitialColor(email) }}
+ >
+ {getInitials(displayName, email)}
+ </span>
+ );
+}
+
interface NoteParticipantsProps {
+ noteId: number;
participants: CalendarAttendee[];
- onUpdate: (participants: CalendarAttendee[]) => void;
}
-export default function NoteParticipants({ participants, onUpdate }: NoteParticipantsProps) {
+export default function NoteParticipants({ noteId, participants }: NoteParticipantsProps) {
const { t } = useTranslation();
const [localParticipants, setLocalParticipants] = useState(participants);
const [search, setSearch] = useState("");
@@ -68,6 +104,15 @@ export default function NoteParticipants({ participants, onUpdate }: NotePartici
});
}, [search, open, localParticipants]);
+ const saveParticipants = useCallback(
+ (updated: CalendarAttendee[]) => {
+ window.electronAPI.updateNote(noteId, {
+ participants: JSON.stringify(updated),
+ });
+ },
+ [noteId]
+ );
+
const addParticipant = useCallback(
(email: string, displayName?: string | null) => {
const normalized = email.toLowerCase().trim();
@@ -77,20 +122,20 @@ export default function NoteParticipants({ participants, onUpdate }: NotePartici
{ email: normalized, displayName: displayName || null, responseStatus: null, self: false },
];
setLocalParticipants(updated);
- onUpdate(updated);
+ saveParticipants(updated);
window.electronAPI.upsertContact({ email: normalized, displayName: displayName || null });
setSearch("");
},
- [localParticipants, onUpdate]
+ [localParticipants, saveParticipants]
);
const removeParticipant = useCallback(
(email: string) => {
const updated = localParticipants.filter((p) => p.email !== email);
setLocalParticipants(updated);
- onUpdate(updated);
+ saveParticipants(updated);
},
- [localParticipants, onUpdate]
+ [localParticipants, saveParticipants]
);
const handleKeyDown = useCallback(
@@ -153,12 +198,12 @@ export default function NoteParticipants({ participants, onUpdate }: NotePartici
onClick={() => addParticipant(contact.email, contact.display_name)}
className="flex items-center gap-2 w-full px-2 py-1.5 rounded-md text-xs text-foreground/70 hover:bg-foreground/5 transition-colors cursor-pointer"
>
- <span
- className="shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white"
- style={{ backgroundColor: getInitialColor(contact.email) }}
- >
- {getInitials(contact.display_name, contact.email)}
- </span>
+ <ParticipantAvatar
+ email={contact.email}
+ displayName={contact.display_name}
+ failed={false}
+ onImageError={() => {}}
+ />
<span className="truncate">{contact.display_name || contact.email}</span>
</button>
))}
@@ -176,50 +221,36 @@ export default function NoteParticipants({ participants, onUpdate }: NotePartici
<div className="px-2 py-1 text-[11px] font-medium text-muted-foreground">
{domain}
</div>
- {members.map((p) => {
- const hash = gravatarHashes[p.email];
- const failed = failedGravatars.has(p.email);
-
- return (
- <div
- key={p.email}
- className="group flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-foreground/5 transition-colors"
- >
- {hash && !failed ? (
- <img
- src={`https://www.gravatar.com/avatar/${hash}?d=404&s=64`}
- alt=""
- loading="lazy"
- className="shrink-0 w-6 h-6 rounded-full object-cover"
- onError={() => setFailedGravatars((prev) => new Set(prev).add(p.email))}
- />
- ) : (
- <span
- className="shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white"
- style={{ backgroundColor: getInitialColor(p.email) }}
- >
- {getInitials(p.displayName, p.email)}
+ {members.map((p) => (
+ <div
+ key={p.email}
+ className="group flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-foreground/5 transition-colors"
+ >
+ <ParticipantAvatar
+ email={p.email}
+ displayName={p.displayName}
+ gravatarHash={gravatarHashes[p.email]}
+ failed={failedGravatars.has(p.email)}
+ onImageError={() => setFailedGravatars((prev) => new Set(prev).add(p.email))}
+ />
+
+ <span className="flex-1 min-w-0 truncate text-xs text-foreground/70">
+ {p.displayName || p.email.split("@")[0]}
+ {p.self && (
+ <span className="ml-1 text-foreground/30">
+ {t("notes.participants.me", "(me)")}
</span>
)}
+ </span>
- <span className="flex-1 min-w-0 truncate text-xs text-foreground/70">
- {p.displayName || p.email.split("@")[0]}
- {p.self && (
- <span className="ml-1 text-foreground/30">
- {t("notes.participants.me", "(me)")}
- </span>
- )}
- </span>
-
- <button
- onClick={() => removeParticipant(p.email)}
- className="shrink-0 opacity-0 group-hover:opacity-100 p-0.5 rounded text-foreground/30 hover:text-foreground/60 transition-opacity cursor-pointer"
- >
- <X size={12} />
- </button>
- </div>
- );
- })}
+ <button
+ onClick={() => removeParticipant(p.email)}
+ className="shrink-0 opacity-0 group-hover:opacity-100 p-0.5 rounded text-foreground/30 hover:text-foreground/60 transition-opacity cursor-pointer"
+ >
+ <X size={12} />
+ </button>
+ </div>
+ ))}
</div>
))}
diff --git a/src/helpers/meetingDetectionEngine.js b/src/helpers/meetingDetectionEngine.js
index 5a79d529b..371597441 100644
--- a/src/helpers/meetingDetectionEngine.js
+++ b/src/helpers/meetingDetectionEngine.js
@@ -194,7 +194,10 @@ class MeetingDetectionEngine {
if (calEvent?.attendees) {
updates.participants = calEvent.attendees;
}
- this.databaseManager.updateNote(noteResult.note.id, updates);
+ const updateResult = this.databaseManager.updateNote(noteResult.note.id, updates);
+ if (updateResult?.success && updateResult?.note) {
+ this.broadcastToWindows("note-updated", updateResult.note);
+ }
}
await this.windowManager.createControlPanelWindow();