Choose whose notes reach your bell
The bell is a shared pile: every active HR person sees every open note, regardless of who wrote it. That was agreed and it stays the default — this narrows it, it never widens it. You can now untick colleagues whose notes you do not want to see. What gets stored is the *exceptions*, not the selection. The difference shows the day someone new joins HR: had the selection been stored, she would be invisible to everyone until each person ticked her, and nobody would notice her follow-ups piling up. This way she is visible from day one and hiding her is a deliberate act. Same reasoning that made notes a shared inbox in the first place — the silent gap is worse than a row too many. Own notes always come through: `note_mutes` rejects a self-reference, and the predicate says so again rather than depending on a check constraint staying put. Notes with no author come through too — hiding one because nobody knows who wrote it is exactly the loss this list exists to prevent. The rule lives in lib/notes.ts as one SQL expression because two places need it: the bell in the header and the "Anstehend" card on the dashboard. Two copies drift, and then the card counts something the bell does not show. No SQL function and no audit row, unlike anything that touches employee data — this is a personal display preference, and an audit trail recording every tick would make finding real changes harder. Same pattern as saved reports and hire drafts, and the owner policy on note_mutes means a row for someone else cannot be written even with invented values. The checkbox flips immediately and flips back if saving fails; the list gets clicked through several at a time and a round trip per tick feels like hesitation. Verified: 19 tests, five mutation-checked (or→and, dropping the own-notes clause, inverting `not exists`, inverting the default, and losing the email fallback each turn them red). Typecheck, lint, schema drift, 477 tests and the build are clean. Not seen in a browser: login goes through the company account and the database is unreachable — the migration is reviewed but has not been run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,10 +25,11 @@ function titleFor(pathname: string): string {
|
||||
type TopbarProps = {
|
||||
userLabel: string;
|
||||
openNotes: OpenNote[];
|
||||
kollegen: { id: string; name: string; sichtbar: boolean }[];
|
||||
onOpenNav: () => void;
|
||||
};
|
||||
|
||||
export function Topbar({ userLabel, openNotes, onOpenNav }: TopbarProps) {
|
||||
export function Topbar({ userLabel, openNotes, kollegen, onOpenNav }: TopbarProps) {
|
||||
const pathname = usePathname();
|
||||
|
||||
return (
|
||||
@@ -47,7 +48,7 @@ export function Topbar({ userLabel, openNotes, onOpenNav }: TopbarProps) {
|
||||
<h1 className="truncate text-base font-bold text-ink">{titleFor(pathname)}</h1>
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-1 sm:gap-4">
|
||||
<NotesBell notes={openNotes} />
|
||||
<NotesBell notes={openNotes} kollegen={kollegen} />
|
||||
<NewHireButton />
|
||||
<div className="flex items-center gap-2 text-sm sm:border-l sm:border-border sm:pl-4">
|
||||
{/* The name is the first thing worth dropping on a narrow screen —
|
||||
|
||||
Reference in New Issue
Block a user