diff --git a/components/contacts/__tests__/directory-picker-dialog.test.tsx b/components/contacts/__tests__/directory-picker-dialog.test.tsx index bb4c719f7..192f8dc4b 100644 --- a/components/contacts/__tests__/directory-picker-dialog.test.tsx +++ b/components/contacts/__tests__/directory-picker-dialog.test.tsx @@ -98,4 +98,14 @@ describe('DirectoryPickerDialog', () => { expect(rows()).toHaveLength(2); expect(screen.getByRole('alert')).toHaveTextContent('refresh_failed'); }); + + // Stalwart 1.0 with directory queries off: the listing holds the principals + // the user knows (their own, their groups), and nothing failed. + it('says the directory is not browsable when it lists only the principals the user knows', () => { + setDirectory(people(1), 'forbidden'); + render(); + expect(rows()).toHaveLength(1); + expect(screen.getByRole('status')).toHaveTextContent('forbidden_hint'); + expect(screen.queryByText('refresh_failed')).not.toBeInTheDocument(); + }); }); diff --git a/components/contacts/directory-browser.tsx b/components/contacts/directory-browser.tsx index 86d0bab2c..9ee8a294b 100644 --- a/components/contacts/directory-browser.tsx +++ b/components/contacts/directory-browser.tsx @@ -187,9 +187,14 @@ export function DirectoryBrowser({ - {entries.length > 0 && (status === "error" || status === "forbidden") && ( + {entries.length > 0 && status === "error" && (

{t("refresh_failed")}

)} + {/* A refused listing (Stalwart 1.0 with directory queries off) still + holds the principals the user knows; nothing failed to refresh. */} + {entries.length > 0 && status === "forbidden" && ( +

{t("forbidden_hint")}

+ )}