Skip to content

Commit

Permalink
Limit media upload on content edit image field to locked group
Browse files Browse the repository at this point in the history
  • Loading branch information
agalin920 committed Jan 10, 2024
1 parent 63649f1 commit 115d476
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ export const Field = ({
}}
name={name}
onChange={onChange}
lockedToGroupId={
settings?.group_id && settings?.group_id !== "0"
? settings.group_id
: null
}
/>
</FieldShell>
{imageModal && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type FieldTypeMediaProps = {
onChange: (value: string, name: string) => void;
hasError?: boolean;
hideDrag?: boolean;
lockedToGroupId: string | null;
};

export const FieldTypeMedia = ({
Expand All @@ -58,6 +59,7 @@ export const FieldTypeMedia = ({
name,
hasError,
hideDrag,
lockedToGroupId,
}: FieldTypeMediaProps) => {
const [draggedIndex, setDraggedIndex] = useState<number | null>(null);
const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
Expand Down Expand Up @@ -125,7 +127,7 @@ export const FieldTypeMedia = ({
return {
file,
bin_id: defaultBin.id,
group_id: defaultBin.id,
group_id: lockedToGroupId ? lockedToGroupId : defaultBin.id,
};
})
)
Expand Down

0 comments on commit 115d476

Please sign in to comment.