[Fix] Read only users should not be able to open a Relation picker (#10666)
## Context ActivityTargetsInlineCell was not using the useIsFieldValueReadOnly hook but a dedicated prop instead. To align with the rest of the implementation I've updated that part of the code however we still want the table/kanban views to always be in read-only mode regardless of the hook logic so I've updated the hook to take the ContextStoreViewType into account.
This commit is contained in:
@ -13,6 +13,7 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi
|
||||
import { useFieldContext } from '@/object-record/hooks/useFieldContext';
|
||||
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
|
||||
import { FieldFocusContextProvider } from '@/object-record/record-field/contexts/FieldFocusContextProvider';
|
||||
import { useIsFieldValueReadOnly } from '@/object-record/record-field/hooks/useIsFieldValueReadOnly';
|
||||
import { RecordFieldInputScope } from '@/object-record/record-field/scopes/RecordFieldInputScope';
|
||||
import { RecordInlineCellContainer } from '@/object-record/record-inline-cell/components/RecordInlineCellContainer';
|
||||
import { RecordInlineCellContext } from '@/object-record/record-inline-cell/components/RecordInlineCellContext';
|
||||
@ -23,7 +24,6 @@ type ActivityTargetsInlineCellProps = {
|
||||
activity: Task | Note;
|
||||
showLabel?: boolean;
|
||||
maxWidth?: number;
|
||||
readonly?: boolean;
|
||||
activityObjectNameSingular:
|
||||
| CoreObjectNameSingular.Note
|
||||
| CoreObjectNameSingular.Task;
|
||||
@ -33,7 +33,6 @@ export const ActivityTargetsInlineCell = ({
|
||||
activity,
|
||||
showLabel = true,
|
||||
maxWidth,
|
||||
readonly,
|
||||
activityObjectNameSingular,
|
||||
}: ActivityTargetsInlineCellProps) => {
|
||||
const { activityTargetObjectRecords } =
|
||||
@ -43,6 +42,8 @@ export const ActivityTargetsInlineCell = ({
|
||||
|
||||
const { fieldDefinition } = useContext(FieldContext);
|
||||
|
||||
const isFieldReadOnly = useIsFieldValueReadOnly();
|
||||
|
||||
useScopedHotkeys(
|
||||
Key.Escape,
|
||||
() => {
|
||||
@ -76,7 +77,7 @@ export const ActivityTargetsInlineCell = ({
|
||||
},
|
||||
IconLabel: showLabel ? IconArrowUpRight : undefined,
|
||||
showLabel: showLabel,
|
||||
readonly: readonly,
|
||||
readonly: isFieldReadOnly,
|
||||
labelWidth: fieldDefinition?.labelWidth,
|
||||
editModeContent: (
|
||||
<ActivityTargetInlineCellEditMode
|
||||
|
||||
@ -95,7 +95,6 @@ export const NoteCard = ({
|
||||
<ActivityTargetsInlineCell
|
||||
activity={note}
|
||||
activityObjectNameSingular={CoreObjectNameSingular.Note}
|
||||
readonly
|
||||
/>
|
||||
</NoteTargetsContextProvider>
|
||||
)}
|
||||
|
||||
@ -134,7 +134,6 @@ export const TaskRow = ({ task }: { task: Task }) => {
|
||||
activity={task}
|
||||
showLabel={false}
|
||||
maxWidth={200}
|
||||
readonly
|
||||
/>
|
||||
</TaskTargetsContextProvider>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user