Skip to content

Commit

Permalink
knowledgebase-disable-new-posts
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinyanakiev committed Jan 24, 2025
1 parent 6033b21 commit 3a1478a
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions src/domain/collaboration/callout/CalloutForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export interface CalloutFormProps {
journeyTypeName: JourneyTypeName;
temporaryLocation?: boolean;
disableRichMedia?: boolean; // images, videos, iframe, etc.
acceptNewResponses?: boolean;
disablePostResponses?: boolean;
}

const CalloutForm = ({
Expand All @@ -105,7 +105,7 @@ const CalloutForm = ({
children,
temporaryLocation = false,
disableRichMedia,
acceptNewResponses = true,
disablePostResponses = false,
}: CalloutFormProps) => {
const { t } = useTranslation();

Expand All @@ -129,7 +129,7 @@ const CalloutForm = ({
type: calloutType,
tagsets,
references: callout?.references ?? [],
opened: acceptNewResponses && (callout?.state ?? CalloutState.Open) === CalloutState.Open,
opened: !disablePostResponses && (callout?.state ?? CalloutState.Open) === CalloutState.Open,
groupName: callout?.groupName ?? CalloutGroupName.Knowledge,
postDescription: callout.postDescription ?? '',
whiteboardContent: callout.whiteboardContent ?? EmptyWhiteboardString,
Expand Down Expand Up @@ -196,7 +196,7 @@ const CalloutForm = ({
tags: true,
postTemplate: calloutType === CalloutType.PostCollection,
whiteboardTemplate: calloutType === CalloutType.WhiteboardCollection,
newResponses: acceptNewResponses && calloutType !== CalloutType.Whiteboard,
newResponses: !disablePostResponses && calloutType !== CalloutType.Whiteboard,
locationChange: editMode && Boolean(canChangeCalloutLocation),
whiteboard: calloutType === CalloutType.Whiteboard,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const CalloutView = ({ callout, ...props }: CalloutViewProps) => {
</WhiteboardCollectionCalloutContainer>
);
case CalloutType.Post:
return <CommentsCallout callout={callout} {...props} />;
return <CommentsCallout callout={callout} disablePostResponses {...props} />;
case CalloutType.LinkCollection:
return <LinkCollectionCallout callout={callout} {...props} />;
case CalloutType.Whiteboard:
Expand Down
2 changes: 1 addition & 1 deletion src/domain/collaboration/callout/CalloutViewTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ export interface BaseCalloutViewProps extends CalloutLayoutEvents, Partial<Callo
onCalloutUpdate?: () => void;
disableMarginal?: boolean;
disableRichMedia?: boolean;
acceptNewResponses?: boolean;
disablePostResponses?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export interface CalloutSettingsContainerProps
onExpand?: () => void;
journeyTypeName: JourneyTypeName;
disableRichMedia?: boolean;
acceptNewResponses?: boolean;
disablePostResponses?: boolean;
}

const CalloutSettingsContainer = ({
Expand All @@ -139,7 +139,7 @@ const CalloutSettingsContainer = ({
journeyTypeName,
children,
disableRichMedia,
acceptNewResponses,
disablePostResponses,
}: CalloutSettingsContainerProps) => {
const { t } = useTranslation();

Expand Down Expand Up @@ -448,7 +448,7 @@ const CalloutSettingsContainer = ({
canChangeCalloutLocation
journeyTypeName={journeyTypeName}
disableRichMedia={disableRichMedia}
acceptNewResponses={acceptNewResponses}
disablePostResponses={disablePostResponses && callout.type === CalloutType.Post}
/>
)}
<ConfirmationDialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export interface CalloutCreationDialogProps {
journeyTypeName: JourneyTypeName;
availableCalloutTypes?: CalloutType[];
disableRichMedia?: boolean;
acceptNewResponses?: boolean;
disablePostResponses?: boolean;
}

const CalloutCreationDialog = ({
Expand All @@ -70,7 +70,7 @@ const CalloutCreationDialog = ({
journeyTypeName,
availableCalloutTypes,
disableRichMedia,
acceptNewResponses,
disablePostResponses,
}: CalloutCreationDialogProps) => {
const { t } = useTranslation();
const [callout, setCallout] = useState<CalloutCreationDialogFields>({});
Expand Down Expand Up @@ -281,7 +281,7 @@ const CalloutCreationDialog = ({
journeyTypeName={journeyTypeName}
temporaryLocation // Always true for callout creation
disableRichMedia={disableRichMedia}
acceptNewResponses={acceptNewResponses}
disablePostResponses={disablePostResponses && selectedCalloutType === CalloutType.Post}
/>
</DialogContent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface CalloutEditDialogProps {
canChangeCalloutLocation?: boolean;
journeyTypeName: JourneyTypeName;
disableRichMedia?: boolean;
acceptNewResponses?: boolean;
disablePostResponses?: boolean;
}

const CalloutEditDialog = ({
Expand All @@ -37,7 +37,7 @@ const CalloutEditDialog = ({
canChangeCalloutLocation,
journeyTypeName,
disableRichMedia,
acceptNewResponses = true,
disablePostResponses = false,
}: CalloutEditDialogProps) => {
const { t } = useTranslation();

Expand Down Expand Up @@ -113,7 +113,7 @@ const CalloutEditDialog = ({
canChangeCalloutLocation={canChangeCalloutLocation}
journeyTypeName={journeyTypeName}
disableRichMedia={disableRichMedia}
acceptNewResponses={acceptNewResponses}
disablePostResponses={disablePostResponses}
/>
</StorageConfigContextProvider>
</DialogContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface CalloutsGroupProps extends CalloutsViewProps {
createButtonPlace?: 'top' | 'bottom';
availableCalloutTypes?: CalloutType[];
disableRichMedia?: boolean;
acceptNewResponses?: boolean;
disablePostResponses?: boolean;
}

const CalloutsGroupView = ({
Expand All @@ -26,7 +26,7 @@ const CalloutsGroupView = ({
calloutsSetId,
availableCalloutTypes,
disableRichMedia,
acceptNewResponses,
disablePostResponses,
...calloutsViewProps
}: CalloutsGroupProps) => {
const {
Expand Down Expand Up @@ -57,7 +57,7 @@ const CalloutsGroupView = ({
<CalloutsView
journeyTypeName={journeyTypeName}
disableRichMedia={disableRichMedia}
acceptNewResponses={acceptNewResponses}
disablePostResponses={disablePostResponses}
{...calloutsViewProps}
/>
{canCreateCallout && createButtonPlace === 'bottom' && createButton}
Expand All @@ -71,7 +71,7 @@ const CalloutsGroupView = ({
journeyTypeName={journeyTypeName}
availableCalloutTypes={availableCalloutTypes}
disableRichMedia={disableRichMedia}
acceptNewResponses={acceptNewResponses}
disablePostResponses={disablePostResponses}
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface CalloutsViewProps {
| ((callout: TypedCallout, index: number) => Partial<PageContentBlockProps> | undefined);
disableMarginal?: boolean;
disableRichMedia?: boolean;
acceptNewResponses?: boolean;
disablePostResponses?: boolean;
}

const CalloutsView = ({
Expand All @@ -53,7 +53,7 @@ const CalloutsView = ({
blockProps,
disableMarginal,
disableRichMedia,
acceptNewResponses,
disablePostResponses,
}: CalloutsViewProps) => {
const { handleEdit, handleVisibilityChange, handleDelete } = useCalloutEdit();

Expand Down Expand Up @@ -140,7 +140,7 @@ const CalloutsView = ({
onExpand={() => handleExpand(calloutDetails)}
disableMarginal={disableMarginal}
disableRichMedia={disableRichMedia}
acceptNewResponses={acceptNewResponses}
disablePostResponses={disablePostResponses}
{...sortEvents}
{...sortProps}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const KnowledgeBaseDialog = ({ onClose, title, id }: KnowledgeBaseDialogProps) =
createButtonPlace="bottom"
availableCalloutTypes={AVAILABLE_CALLOUT_TYPES}
disableRichMedia
acceptNewResponses={false}
disablePostResponses
/>
</Gutters>
</StorageConfigContextProvider>
Expand Down

0 comments on commit 3a1478a

Please sign in to comment.