mirror of
https://github.com/docmost/docmost.git
synced 2026-08-28 01:07:08 +08:00
feat(ee): space control to hide comments from viewers role
This commit is contained in:
@@ -17,7 +17,12 @@ export default function SpaceViewerCommentsToggle({
|
||||
const { t } = useTranslation();
|
||||
const hasViewerComments = useHasFeature(Feature.VIEWER_COMMENTS);
|
||||
const upgradeLabel = useUpgradeLabel();
|
||||
const isDisabled = !hasViewerComments;
|
||||
const hideCommentsEnabled =
|
||||
space.settings?.comments?.hideCommentsFromViewers === true;
|
||||
const isDisabled = !hasViewerComments || hideCommentsEnabled;
|
||||
const tooltipLabel = !hasViewerComments
|
||||
? upgradeLabel
|
||||
: t("Turn off 'Hide comments from viewers' first");
|
||||
const [checked, setChecked] = useState(
|
||||
space.settings?.comments?.allowViewerComments === true,
|
||||
);
|
||||
@@ -45,7 +50,7 @@ export default function SpaceViewerCommentsToggle({
|
||||
</Text>
|
||||
</div>
|
||||
<Tooltip
|
||||
label={upgradeLabel}
|
||||
label={tooltipLabel}
|
||||
disabled={!isDisabled}
|
||||
refProp="rootRef"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user