Skip to content

The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.

Member view of Workspace › General: Show, name as text, admins-only note on Recordings (PR 1948)

Janikf14486b05a8c
diff --git a/apps/web/src/settings/Recordings.test.tsx b/apps/web/src/settings/Recordings.test.tsx
index 4dde1b26..71159841 100644
--- a/apps/web/src/settings/Recordings.test.tsx
+++ b/apps/web/src/settings/Recordings.test.tsx
@@ -51,6 +51,15 @@ test('recording on: no note, the controls work as before', () => {
expect(disabledControls(render(true, false))).toBe(1)
})
+test('a member sees why nothing changes, once at the top, also with recording off on the server', () => {
+ for (const on of [true, false]) {
+ const html = render(on, false)
+ expect(html.split('Only admins can change these settings.').length - 1).toBe(1)
+ expect(html).not.toContain('Only admins can change this.')
+ }
+ expect(render(true)).not.toContain('Only admins can change')
+})
+
test('law hints by setting and country: only notes, every control stays usable (A4, A5)', () => {
const eu = "In the EU and the UK, recording a call usually needs the caller's consent"
const long = 'Privacy laws such as the GDPR'
diff --git a/apps/web/src/settings/Recordings.tsx b/apps/web/src/settings/Recordings.tsx
index 6abc469a..e0f2074c 100644
--- a/apps/web/src/settings/Recordings.tsx
+++ b/apps/web/src/settings/Recordings.tsx
@@ -12,7 +12,7 @@ import { Select, type SelectOption } from '../ui/controls.tsx'
import type { LineState } from '../ui/FeatureLine.tsx'
import { Note } from '../ui/kit.tsx'
import { Loading, Skeleton } from '../ui/LoadStates.tsx'
-import { useReadOnlyNote } from './readOnly.ts'
+import { ReadOnlyNote } from './fields.tsx'
import { patchWorkspaceSettings, useWorkspaceSettings } from './settings-api.ts'
import { FormField } from '../ui/form.tsx'
@@ -64,7 +64,6 @@ const LONG_RETENTION_DAYS = 90
export function Recordings({ canEdit, toast }: { canEdit: boolean; toast: (text: string) => void }) {
const t = useT()
- const readOnly = useReadOnlyNote()
const run = useRun()
const settings = useWorkspaceSettings()
const days = settings.data?.recordingRetentionDays
@@ -97,6 +96,8 @@ export function Recordings({ canEdit, toast }: { canEdit: boolean; toast: (text:
return (
<>
+ {/* Members: why nothing here can change, once at the top, as on General's fields (also with recording off). */}
+ {!canEdit && <ReadOnlyNote />}
{settings.data && !recordingOn && <RecordingOffNote />}
<Loading
what={t('settings.recordings.loadWhat')}
@@ -113,7 +114,7 @@ export function Recordings({ canEdit, toast }: { canEdit: boolean; toast: (text:
<FormField
id="st-retention"
label={t('settings.recordings.keepFor')}
- description={canEdit || !recordingOn ? lawHints.join(' ') || undefined : readOnly}
+ description={lawHints.join(' ') || undefined}
>
<div>
<Select
diff --git a/apps/web/src/settings/WorkspaceGeneral.tsx b/apps/web/src/settings/WorkspaceGeneral.tsx
index c02db26b..67895158 100644
--- a/apps/web/src/settings/WorkspaceGeneral.tsx
+++ b/apps/web/src/settings/WorkspaceGeneral.tsx
@@ -1,6 +1,6 @@
// Workspace settings › General: what is the same for the whole workspace (LIN-837). On top one card says who the
// business is: its icon, its name and one line with the kind of business, the country and the time there. Edit (members:
-// Details) opens the fields under it: the business name (workspace.rename), the workspace icon (WorkspaceIconField),
+// Show) opens the fields under it: the business name (workspace.rename), the workspace icon (WorkspaceIconField),
// the kind of business (LIN-680), the country (Automatic until set: workspace-locale.ts), the time zone (Hours &
// holidays links here) and the value of a booked appointment (also set from the Insights summary). Owners and admins
// change them; members see them, with one note on top saying why they can't. Under Calls, lines as on Server admin ›
@@ -161,7 +161,8 @@ export function WorkspaceGeneral({ canEdit, name, onRenamed, toast }: Props) {
mark={<WorkspaceMark name={name} iconUrl={workspaceIconOf(useWorkspaces(), tabWorkspace() ?? '')} size="lg" />}
name={name}
line={<IdentityLine />}
- editLabel={canEdit ? t('settings.general.edit') : t('settings.general.details')}
+ // Members only look: Show, as on every line they cannot change.
+ editLabel={canEdit ? t('settings.general.edit') : t('admin.features.show')}
open={editing}
onToggle={() => setEditing(open => !open)}
bodyId="ws-general-fields"
@@ -175,6 +176,7 @@ export function WorkspaceGeneral({ canEdit, name, onRenamed, toast }: Props) {
summary={t('settings.recordings.summary')}
help={recording?.warning ? t('settings.recordings.helpOff') : t('settings.recordings.help')}
state={recording}
+ view={!canEdit}
{...line('recordings')}
>
<Recordings canEdit={canEdit} toast={toast} />
@@ -270,6 +272,17 @@ function BusinessName({ canEdit, name, onRenamed, toast }: Props) {
}
}
+ // Members: the name as text like the fields under it, not a field that looks as if it could change.
+ if (!canEdit)
+ return (
+ <FormField id="ws-name" label={t('settings.general.name.label')} help={t('settings.general.name.tip')}>
+ <div className="ws-value">
+ <span className="ws-value-text" id="ws-name">
+ {name}
+ </span>
+ </div>
+ </FormField>
+ )
return (
<FormField
id="ws-name"
@@ -280,7 +293,6 @@ function BusinessName({ canEdit, name, onRenamed, toast }: Props) {
<Input
id="ws-name"
value={draft}
- readOnly={!canEdit}
invalid={!!problem}
autoComplete="organization"
onChange={e => setDraft(e.target.value)}
diff --git a/apps/web/src/settings/workspaceGeneralLinks.test.tsx b/apps/web/src/settings/workspaceGeneralLinks.test.tsx
index 4f654f76..9aea3502 100644
--- a/apps/web/src/settings/workspaceGeneralLinks.test.tsx
+++ b/apps/web/src/settings/workspaceGeneralLinks.test.tsx
@@ -35,7 +35,10 @@ test('closed: the business card with Edit, then Recordings and (owners and admin
expect(admin).toContain('Export calls')
expect(admin).not.toContain('Caller privacy notice')
const member = render(false, false, '#workspace/general')
- expect(member).toContain('>Details<')
+ // Members only look: Show, never Details or Change.
+ expect(member).toContain('>Show<')
+ expect(member).not.toContain('>Details<')
+ expect(member).not.toContain('>Change<')
expect(member).not.toContain('Export calls')
// A link to a line opens it.
expect(render(true, false, '#workspace/general/export')).toContain('Export CSV')
@@ -53,5 +56,7 @@ test('during support access every field is read-only and says why', () => {
const html = render(false, true)
expect(html).toContain('Read-only while you are signed in as another user.')
expect(html).not.toContain('Only admins can change this.')
- expect(html).toMatch(/id="ws-name"[^>]*readOnly|readOnly[^>]*id="ws-name"/i)
+ // The name reads as text, not as a field that looks as if it could change.
+ expect(html).toContain('<span class="ws-value-text" id="ws-name">')
+ expect(html).not.toMatch(/<input[^>]*id="ws-name"/)
})
diff --git a/packages/i18n/locales/en/settings.json b/packages/i18n/locales/en/settings.json
index 92d28726..21b8c55e 100644
--- a/packages/i18n/locales/en/settings.json
+++ b/packages/i18n/locales/en/settings.json
@@ -803,7 +803,6 @@
"general.country.source": "{source, select, assistant_number {from your assistant's number} business_phone {from your business phone} holidays {from your holiday calendar} sign_up_location {from where the workspace was created} time_zone {from the time zone it was created in} browser_language {from the browser language it was created in} other {automatic}}",
"general.country.tip": "Where the business is. Phone numbers, the forwarding guide, holidays and the currency start with it, and the assistant reads the numbers callers say the way they are written there.",
"general.country.what": "The country",
- "general.details": "Details",
"general.edit": "Edit",
"general.identity.time": "{time} in {city}",
"general.kind.label": "Kind of business",