mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 10:21:35 +03:00
fix(core): workspace sharing settings should not be displayed when there is no permission (#8285)
close AF-1222
This commit is contained in:
parent
fab23d226d
commit
af5b9a3a23
@ -4,6 +4,7 @@ import {
|
||||
SettingWrapper,
|
||||
} from '@affine/component/setting-components';
|
||||
import { useAsyncCallback } from '@affine/core/components/hooks/affine-async-hooks';
|
||||
import { WorkspacePermissionService } from '@affine/core/modules/permissions';
|
||||
import { WorkspaceShareSettingService } from '@affine/core/modules/share-setting';
|
||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
@ -22,6 +23,8 @@ export const Sharing = () => {
|
||||
const shareSetting = useService(WorkspaceShareSettingService).sharePreview;
|
||||
const enableUrlPreview = useLiveData(shareSetting.enableUrlPreview$);
|
||||
const loading = useLiveData(shareSetting.isLoading$);
|
||||
const permissionService = useService(WorkspacePermissionService);
|
||||
const isOwner = useLiveData(permissionService.permission.isOwner$);
|
||||
|
||||
const handleCheck = useAsyncCallback(
|
||||
async (checked: boolean) => {
|
||||
@ -30,6 +33,10 @@ export const Sharing = () => {
|
||||
[shareSetting]
|
||||
);
|
||||
|
||||
if (!isOwner) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<SettingWrapper title={t['com.affine.settings.workspace.sharing.title']()}>
|
||||
<SettingRow
|
||||
|
@ -1420,11 +1420,8 @@
|
||||
"com.affine.settings.workspace.publish-tooltip": "Enable AFFiNE Cloud to publish this workspace",
|
||||
"com.affine.settings.workspace.sharing.title": "Sharing",
|
||||
"com.affine.settings.workspace.sharing.url-preview.description": "Allow URL unfurling by Slack & other social apps, even if a doc is only accessible by workspace members.",
|
||||
"com.affine.settings.workspace.sharing.url-preview.title": "Always Enable URL Preview",
|
||||
"com.affine.settings.workspace.sharing.url-preview.title": "Always enable url preview",
|
||||
"com.affine.settings.workspace.storage.tip": "Click to move storage location.",
|
||||
"com.affine.settings.workspace.sharing.title": "Sharing",
|
||||
"com.affine.settings.workspace.sharing.url-preview.title": "Always Enable URL Preview",
|
||||
"com.affine.settings.workspace.sharing.url-preview.description": "Allow URL unfurling by Slack & other social apps, even if a doc is only accessible by workspace members.",
|
||||
"com.affine.share-menu.EnableCloudDescription": "Sharing doc requires AFFiNE Cloud.",
|
||||
"com.affine.share-menu.ShareMode": "Share mode",
|
||||
"com.affine.share-menu.SharePage": "Share doc",
|
||||
|
Loading…
Reference in New Issue
Block a user