mirror of
https://github.com/outline/outline.git
synced 2026-11-23 06:11:04 +03:00
tweak ui, other fixes
This commit is contained in:
14 files changed
+286
-184
No files matched your search
@@ -131,7 +131,7 @@ export const editCollectionPermissions = createAction({
|
||||
}
|
||||
|
||||
stores.dialogs.openModal({
|
||||
title: t("Share this collection"),
|
||||
title: t(`Share "{{ itemName }}"`, { itemName: collection.name }),
|
||||
content: (
|
||||
<SharePopover
|
||||
collection={collection}
|
||||
|
||||
@@ -594,7 +594,7 @@ export const shareDocument = createAction({
|
||||
}
|
||||
|
||||
stores.dialogs.openModal({
|
||||
title: t("Share this document"),
|
||||
title: t(`Share "{{ itemName }}"`, { itemName: document.title }),
|
||||
content: (
|
||||
<SharePopover
|
||||
document={document}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import * as React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
import { s } from "@shared/styles";
|
||||
import type { Option } from "~/components/InputSelect";
|
||||
import { InputSelect } from "~/components/InputSelect";
|
||||
import type { Permission } from "~/types";
|
||||
@@ -34,7 +32,7 @@ export default function InputMemberPermissionSelect(
|
||||
);
|
||||
|
||||
return (
|
||||
<Select
|
||||
<InputSelect
|
||||
options={options}
|
||||
value={value || EmptySelectValue}
|
||||
onChange={onChange}
|
||||
@@ -45,7 +43,3 @@ export default function InputMemberPermissionSelect(
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const Select = styled(InputSelect)`
|
||||
color: ${s("textSecondary")};
|
||||
`;
|
||||
@@ -342,7 +342,7 @@ function Option({
|
||||
<>
|
||||
|
||||
<Text type="tertiary" size="small" ellipsis>
|
||||
– {option.description}
|
||||
· {option.description}
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { observer } from "mobx-react";
|
||||
import { UserIcon } from "outline-icons";
|
||||
import { PadlockIcon } from "outline-icons";
|
||||
import * as React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
@@ -11,8 +11,9 @@ import type Collection from "~/models/Collection";
|
||||
import type Share from "~/models/Share";
|
||||
import { Avatar, GroupAvatar, AvatarSize } from "~/components/Avatar";
|
||||
import InputMemberPermissionSelect from "~/components/InputMemberPermissionSelect";
|
||||
import { InputSelectPermission } from "~/components/InputSelectPermission";
|
||||
import { InputSelect, type Option } from "~/components/InputSelect";
|
||||
import Scrollable from "~/components/Scrollable";
|
||||
import TeamLogo from "~/components/TeamLogo";
|
||||
import useCurrentTeam from "~/hooks/useCurrentTeam";
|
||||
import useMaxHeight from "~/hooks/useMaxHeight";
|
||||
import usePolicy from "~/hooks/usePolicy";
|
||||
@@ -20,7 +21,12 @@ import useRequest from "~/hooks/useRequest";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import type { Permission } from "~/types";
|
||||
import { EmptySelectValue } from "~/types";
|
||||
import { Separator, GroupMembersPopover } from "../components";
|
||||
import {
|
||||
SectionHeading,
|
||||
SmallInputSelect,
|
||||
Separator,
|
||||
GroupMembersPopover,
|
||||
} from "../components";
|
||||
import { ListItem } from "../components/ListItem";
|
||||
import { Placeholder } from "../components/Placeholder";
|
||||
import { PublicAccess } from "./PublicAccess";
|
||||
@@ -92,6 +98,38 @@ export const AccessControlList = observer(
|
||||
calcMaxHeight();
|
||||
});
|
||||
|
||||
const accessOptions: Option[] = React.useMemo(
|
||||
() => [
|
||||
{
|
||||
type: "item",
|
||||
label: t("Everyone in workspace"),
|
||||
value: "everyone",
|
||||
},
|
||||
{
|
||||
type: "item",
|
||||
label: t("Restricted"),
|
||||
value: "invited",
|
||||
},
|
||||
],
|
||||
[t]
|
||||
);
|
||||
|
||||
const permissionOptions: Option[] = React.useMemo(
|
||||
() => [
|
||||
{
|
||||
type: "item",
|
||||
label: t("View only"),
|
||||
value: CollectionPermission.Read,
|
||||
},
|
||||
{
|
||||
type: "item",
|
||||
label: t("Can edit"),
|
||||
value: CollectionPermission.ReadWrite,
|
||||
},
|
||||
],
|
||||
[t]
|
||||
);
|
||||
|
||||
const permissions = React.useMemo(
|
||||
() =>
|
||||
[
|
||||
@@ -126,33 +164,65 @@ export const AccessControlList = observer(
|
||||
}}
|
||||
>
|
||||
<>
|
||||
<SectionHeading>General access</SectionHeading>
|
||||
<ListItem
|
||||
image={
|
||||
<Squircle color={theme.accent} size={AvatarSize.Medium}>
|
||||
<UserIcon color={theme.accentText} size={16} />
|
||||
</Squircle>
|
||||
collection.isPrivate ? (
|
||||
<Squircle color={theme.textTertiary} size={AvatarSize.Medium}>
|
||||
<PadlockIcon color={theme.white} size={16} />
|
||||
</Squircle>
|
||||
) : (
|
||||
<TeamLogo model={team} size={AvatarSize.Medium} />
|
||||
)
|
||||
}
|
||||
title={
|
||||
<SmallInputSelect
|
||||
options={accessOptions}
|
||||
value={collection.permission ? "everyone" : "invited"}
|
||||
onChange={(value: string) => {
|
||||
if (value === "invited") {
|
||||
void collection.save({ permission: null });
|
||||
} else {
|
||||
void collection.save({
|
||||
permission: CollectionPermission.Read,
|
||||
});
|
||||
}
|
||||
}}
|
||||
label={t("Access")}
|
||||
hideLabel
|
||||
disabled={!can.update}
|
||||
short
|
||||
nude
|
||||
/>
|
||||
}
|
||||
subtitle={
|
||||
collection.isPrivate
|
||||
? t("Only invited users can access")
|
||||
: t("All members of {{ itemName }}", {
|
||||
itemName: team.name,
|
||||
})
|
||||
}
|
||||
title={t("All members")}
|
||||
subtitle={t("Everyone in the workspace")}
|
||||
actions={
|
||||
<div style={{ marginRight: -8 }}>
|
||||
<InputSelectPermission
|
||||
onChange={(
|
||||
value: CollectionPermission | typeof EmptySelectValue
|
||||
) => {
|
||||
void collection.save({
|
||||
permission: value === EmptySelectValue ? null : value,
|
||||
});
|
||||
}}
|
||||
disabled={!can.update}
|
||||
value={collection?.permission}
|
||||
hideLabel
|
||||
nude
|
||||
shrink
|
||||
/>
|
||||
{collection.permission && (
|
||||
<InputSelect
|
||||
options={permissionOptions}
|
||||
value={collection.permission}
|
||||
onChange={(value: string) => {
|
||||
void collection.save({
|
||||
permission: value as CollectionPermission,
|
||||
});
|
||||
}}
|
||||
label={t("Permission")}
|
||||
hideLabel
|
||||
disabled={!can.update}
|
||||
nude
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<SectionHeading>People with access</SectionHeading>
|
||||
{showLoading ? (
|
||||
<Placeholder />
|
||||
) : (
|
||||
|
||||
@@ -147,7 +147,7 @@ function InnerPublicAccess(
|
||||
return (
|
||||
<div ref={ref}>
|
||||
<ListItem
|
||||
title={t("Web")}
|
||||
title={t("Publish to web")}
|
||||
subtitle={<>{t("Allow anyone with the link to access")}</>}
|
||||
image={
|
||||
<Squircle color={theme.text} size={AvatarSize.Medium}>
|
||||
|
||||
@@ -1,36 +1,28 @@
|
||||
import { observer } from "mobx-react";
|
||||
import {
|
||||
PadlockIcon,
|
||||
MoreIcon,
|
||||
QuestionMarkIcon,
|
||||
UserIcon,
|
||||
} from "outline-icons";
|
||||
import { PadlockIcon, MoreIcon, QuestionMarkIcon } from "outline-icons";
|
||||
import * as React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useTranslation, Trans } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import styled, { useTheme } from "styled-components";
|
||||
import Squircle from "@shared/components/Squircle";
|
||||
import { Pagination } from "@shared/constants";
|
||||
import { s } from "@shared/styles";
|
||||
import { CollectionPermission, IconType } from "@shared/types";
|
||||
import { determineIconType } from "@shared/utils/icon";
|
||||
import type Collection from "~/models/Collection";
|
||||
import { CollectionPermission } from "@shared/types";
|
||||
import type Document from "~/models/Document";
|
||||
import type Share from "~/models/Share";
|
||||
import Flex from "~/components/Flex";
|
||||
import NudeButton from "~/components/NudeButton";
|
||||
import TeamLogo from "~/components/TeamLogo";
|
||||
import Scrollable from "~/components/Scrollable";
|
||||
import Switch from "~/components/Switch";
|
||||
import Text from "~/components/Text";
|
||||
import useCurrentTeam from "~/hooks/useCurrentTeam";
|
||||
import useCurrentUser from "~/hooks/useCurrentUser";
|
||||
import useMaxHeight from "~/hooks/useMaxHeight";
|
||||
import usePolicy from "~/hooks/usePolicy";
|
||||
import useRequest from "~/hooks/useRequest";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import { Avatar, AvatarSize } from "../../Avatar";
|
||||
import CollectionIcon from "../../Icons/CollectionIcon";
|
||||
import Tooltip from "../../Tooltip";
|
||||
import { Separator } from "../components";
|
||||
import { SectionHeading, Separator, SmallInputSelect } from "../components";
|
||||
import { ListItem } from "../components/ListItem";
|
||||
import { Placeholder } from "../components/Placeholder";
|
||||
import DocumentMemberList from "./DocumentMemberList";
|
||||
@@ -63,9 +55,7 @@ export const AccessControlList = observer(
|
||||
const { t } = useTranslation();
|
||||
const theme = useTheme();
|
||||
const collection = document.collection;
|
||||
const usersInCollection = useUsersInCollection(collection);
|
||||
const user = useCurrentUser();
|
||||
const { userMemberships, groupMemberships } = useStores();
|
||||
const { documents, userMemberships, groupMemberships } = useStores();
|
||||
const collectionSharingDisabled = document.collection?.sharing === false;
|
||||
const team = useCurrentTeam();
|
||||
const can = usePolicy(document);
|
||||
@@ -81,10 +71,35 @@ export const AccessControlList = observer(
|
||||
margin: 24,
|
||||
});
|
||||
|
||||
const handleToggleRestricted = React.useCallback(async () => {
|
||||
const newValue = !document.isPrivate;
|
||||
await document.save({ isPrivate: newValue });
|
||||
}, [document]);
|
||||
const parentDocument = document.parentDocumentId
|
||||
? documents.get(document.parentDocumentId)
|
||||
: undefined;
|
||||
const parentIsPrivate = parentDocument?.isPrivate ?? false;
|
||||
|
||||
const handleAccessChange = React.useCallback(
|
||||
async (value: string) => {
|
||||
await document.save({ isPrivate: value === "private" });
|
||||
},
|
||||
[document]
|
||||
);
|
||||
|
||||
const accessOptions: Option[] = React.useMemo(
|
||||
() => [
|
||||
{
|
||||
type: "item" as const,
|
||||
label: t("Restricted"),
|
||||
value: "private",
|
||||
},
|
||||
{
|
||||
type: "item" as const,
|
||||
label: collection.isPrivate
|
||||
? t("Collection members")
|
||||
: t("Everyone in workspace"),
|
||||
value: "inherited",
|
||||
},
|
||||
],
|
||||
[t]
|
||||
);
|
||||
|
||||
const { loading: userMembershipLoading, request: fetchUserMemberships } =
|
||||
useRequest(
|
||||
@@ -132,45 +147,67 @@ export const AccessControlList = observer(
|
||||
>
|
||||
{!document.isDraft && can.restrict && (
|
||||
<>
|
||||
<SectionHeading>General access</SectionHeading>
|
||||
<ListItem
|
||||
image={
|
||||
<Squircle
|
||||
color={
|
||||
document.isPrivate ? theme.danger : theme.textTertiary
|
||||
}
|
||||
size={AvatarSize.Medium}
|
||||
>
|
||||
<PadlockIcon color={theme.white} size={16} />
|
||||
</Squircle>
|
||||
document.isPrivate || collection.isPrivate ? (
|
||||
<Squircle
|
||||
color={theme.textTertiary}
|
||||
size={AvatarSize.Medium}
|
||||
>
|
||||
<PadlockIcon color={theme.white} size={16} />
|
||||
</Squircle>
|
||||
) : (
|
||||
<TeamLogo model={team} size={AvatarSize.Medium} />
|
||||
)
|
||||
}
|
||||
title={
|
||||
document.isPrivate
|
||||
? t("Access managed independently")
|
||||
: t("Inherits access")
|
||||
}
|
||||
subtitle={
|
||||
document.isPrivate
|
||||
? t("Only explicitly added members can access")
|
||||
: collection
|
||||
? t("From {{ collectionName }}", {
|
||||
collectionName: collection.name,
|
||||
})
|
||||
: t("From parent document")
|
||||
}
|
||||
actions={
|
||||
<Switch
|
||||
aria-label={t("Restrict access")}
|
||||
checked={document.isPrivate}
|
||||
onChange={handleToggleRestricted}
|
||||
disabled={!can.restrict}
|
||||
<SmallInputSelect
|
||||
options={accessOptions}
|
||||
value={document.isPrivate ? "private" : "inherited"}
|
||||
onChange={handleAccessChange}
|
||||
label={t("Access")}
|
||||
hideLabel
|
||||
short
|
||||
disabled={!can.restrict || parentIsPrivate}
|
||||
nude
|
||||
/>
|
||||
}
|
||||
subtitle={
|
||||
document.isPrivate ? (
|
||||
t("Only invited users can access")
|
||||
) : parentIsPrivate ? (
|
||||
<Trans>
|
||||
Required by{" "}
|
||||
<StyledLink to={parentDoxcument?.path ?? ""}>
|
||||
parent
|
||||
</StyledLink>
|
||||
</Trans>
|
||||
) : collection.isPrivate ? (
|
||||
t("Members of {{ itemName }} can access", {
|
||||
itemName: collection.name,
|
||||
})
|
||||
) : (
|
||||
t("All members of {{ itemName }}", {
|
||||
itemName: team.name,
|
||||
})
|
||||
)
|
||||
}
|
||||
actions={
|
||||
document.isPrivate || collection.isPrivate ? null : (
|
||||
<AccessTooltip content={t("Inherited from collection")}>
|
||||
{collection.permission === CollectionPermission.Read
|
||||
? t("View only")
|
||||
: t("Can edit")}
|
||||
</AccessTooltip>
|
||||
)
|
||||
}
|
||||
/>
|
||||
<Separator />
|
||||
</>
|
||||
)}
|
||||
{document.isDraft ? (
|
||||
<>
|
||||
<SectionHeading>People with access</SectionHeading>
|
||||
<ListItem
|
||||
image={<Avatar model={document.createdBy} />}
|
||||
title={document.createdBy?.name}
|
||||
@@ -191,40 +228,7 @@ export const AccessControlList = observer(
|
||||
</>
|
||||
) : collection && canCollection.readDocument ? (
|
||||
<>
|
||||
{!document.isPrivate &&
|
||||
(collection.permission ? (
|
||||
<ListItem
|
||||
image={
|
||||
<Squircle color={theme.accent} size={AvatarSize.Medium}>
|
||||
<UserIcon color={theme.accentText} size={16} />
|
||||
</Squircle>
|
||||
}
|
||||
title={t("All members")}
|
||||
subtitle={t("Everyone in the workspace")}
|
||||
actions={
|
||||
<AccessTooltip>
|
||||
{collection?.permission ===
|
||||
CollectionPermission.ReadWrite
|
||||
? t("Can edit")
|
||||
: t("Can view")}
|
||||
</AccessTooltip>
|
||||
}
|
||||
/>
|
||||
) : usersInCollection ? (
|
||||
<ListItem
|
||||
image={<CollectionSquircle collection={collection} />}
|
||||
title={collection.name}
|
||||
subtitle={t("Everyone in the collection")}
|
||||
actions={<AccessTooltip>{t("Can view")}</AccessTooltip>}
|
||||
/>
|
||||
) : (
|
||||
<ListItem
|
||||
image={<Avatar model={user} />}
|
||||
title={user.name}
|
||||
subtitle={t("You have full access")}
|
||||
actions={<AccessTooltip>{t("Can edit")}</AccessTooltip>}
|
||||
/>
|
||||
))}
|
||||
<SectionHeading>People with access</SectionHeading>{" "}
|
||||
{showLoading ? (
|
||||
<Placeholder />
|
||||
) : (
|
||||
@@ -303,43 +307,6 @@ const AccessTooltip = ({
|
||||
);
|
||||
};
|
||||
|
||||
const CollectionSquircle = ({ collection }: { collection: Collection }) => {
|
||||
const theme = useTheme();
|
||||
const iconType = determineIconType(collection.icon)!;
|
||||
const squircleColor =
|
||||
iconType === IconType.SVG ? collection.color! : theme.slateLight;
|
||||
const iconSize = iconType === IconType.SVG ? 16 : 22;
|
||||
|
||||
return (
|
||||
<Squircle color={squircleColor} size={AvatarSize.Medium}>
|
||||
<CollectionIcon
|
||||
collection={collection}
|
||||
color={theme.white}
|
||||
size={iconSize}
|
||||
/>
|
||||
</Squircle>
|
||||
);
|
||||
};
|
||||
|
||||
function useUsersInCollection(collection?: Collection) {
|
||||
const { users, memberships } = useStores();
|
||||
const { request } = useRequest(() =>
|
||||
memberships.fetchPage({ limit: 1, id: collection!.id })
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (collection && !collection.permission) {
|
||||
void request();
|
||||
}
|
||||
}, [collection]);
|
||||
|
||||
return collection
|
||||
? collection.permission
|
||||
? true
|
||||
: users.inCollection(collection.id).length > 1
|
||||
: false;
|
||||
}
|
||||
|
||||
const Wrapper = styled(Flex)`
|
||||
flex-direction: column;
|
||||
`;
|
||||
@@ -350,6 +317,11 @@ const Sticky = styled.div`
|
||||
bottom: 0;
|
||||
`;
|
||||
|
||||
const StyledLink = styled(Link)`
|
||||
color: ${s("textTertiary")};
|
||||
text-decoration: underline;
|
||||
`;
|
||||
|
||||
const ScrollableContainer = styled(Scrollable)`
|
||||
padding: 12px 24px;
|
||||
margin: -12px -24px;
|
||||
|
||||
@@ -99,7 +99,7 @@ const DocumentMemberListItem = ({
|
||||
)
|
||||
}
|
||||
actions={
|
||||
<div style={{ marginRight: -8 }}>
|
||||
<div style={{ marginRight: -6 }}>
|
||||
<InputMemberPermissionSelect
|
||||
permissions={
|
||||
onLeave
|
||||
|
||||
@@ -162,7 +162,7 @@ function PublicAccess(
|
||||
return (
|
||||
<div ref={ref}>
|
||||
<ListItem
|
||||
title={t("Web")}
|
||||
title={t("Publish to web")}
|
||||
subtitle={
|
||||
<>
|
||||
{sharedParent && !document.isDraft ? (
|
||||
|
||||
@@ -2,10 +2,13 @@ import { darken } from "polished";
|
||||
import styled from "styled-components";
|
||||
import Flex from "@shared/components/Flex";
|
||||
import { s, hover } from "@shared/styles";
|
||||
import { InputSelect } from "~/components/InputSelect";
|
||||
import NudeButton from "~/components/NudeButton";
|
||||
import Input, { NativeInput } from "~/components/Input";
|
||||
import Text from "~/components/Text";
|
||||
import { InfoIcon } from "outline-icons";
|
||||
import { Link } from "react-router-dom";
|
||||
import { transparentize } from "polished";
|
||||
|
||||
export { GroupMembersPopover } from "./GroupMembersPopover";
|
||||
|
||||
@@ -60,7 +63,8 @@ export const HeaderInput = styled(Flex)`
|
||||
top: 0;
|
||||
background: ${s("menuBackground")};
|
||||
color: ${s("textTertiary")};
|
||||
border-bottom: 1px solid ${s("inputBorder")};
|
||||
border-bottom: 1px solid
|
||||
${(props) => transparentize(0.4, props.theme.inputBorder)};
|
||||
padding: 0 24px 12px;
|
||||
margin-top: 0;
|
||||
margin-left: -24px;
|
||||
@@ -79,6 +83,41 @@ export const HeaderInput = styled(Flex)`
|
||||
}
|
||||
`;
|
||||
|
||||
/** Section heading used in share popovers. */
|
||||
export const SectionHeading = styled(Text).attrs({
|
||||
as: "div",
|
||||
type: "secondary",
|
||||
size: "small",
|
||||
weight: "bold",
|
||||
})`
|
||||
&:not(:first-child) {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
margin-bottom: 2px;
|
||||
`;
|
||||
|
||||
/** Compact InputSelect for use inline in share popover rows. */
|
||||
export const SmallInputSelect = styled(InputSelect)`
|
||||
width: fit-content;
|
||||
height: 24px;
|
||||
margin: -4px -4px 0;
|
||||
|
||||
&:hover:not(:disabled),
|
||||
&:focus-visible,
|
||||
&[aria-expanded="true"] {
|
||||
box-shadow: none;
|
||||
background: none;
|
||||
}
|
||||
|
||||
& > * {
|
||||
min-height: 0;
|
||||
font-weight: 500;
|
||||
padding-left: 4px !important;
|
||||
padding-right: 4px !important;
|
||||
}
|
||||
`;
|
||||
|
||||
export const presence = {
|
||||
initial: {
|
||||
opacity: 0,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { observer } from "mobx-react";
|
||||
import { GlobeIcon } from "outline-icons";
|
||||
import { GlobeIcon, PadlockIcon } from "outline-icons";
|
||||
import { Suspense, useCallback, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import type Document from "~/models/Document";
|
||||
@@ -44,7 +44,11 @@ function ShareButton({ document }: Props) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const icon = document.isPubliclyShared ? <GlobeIcon /> : undefined;
|
||||
const icon = document.isPrivate ? (
|
||||
<PadlockIcon />
|
||||
) : document.isPubliclyShared ? (
|
||||
<GlobeIcon />
|
||||
) : undefined;
|
||||
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
|
||||
@@ -234,18 +234,22 @@ export default class WebsocketsProcessor {
|
||||
},
|
||||
paranoid: false,
|
||||
});
|
||||
documents.forEach((document) => {
|
||||
socketio.to(`collection-${document.collectionId}`).emit("entities", {
|
||||
event: event.name,
|
||||
invalidatedPolicies: [document.id],
|
||||
documentIds: [
|
||||
{
|
||||
id: document.id,
|
||||
updatedAt: document.updatedAt,
|
||||
},
|
||||
],
|
||||
documents
|
||||
.filter((document) => !document.isPrivate)
|
||||
.forEach((document) => {
|
||||
socketio
|
||||
.to(`collection-${document.collectionId}`)
|
||||
.emit("entities", {
|
||||
event: event.name,
|
||||
invalidatedPolicies: [document.id],
|
||||
documentIds: [
|
||||
{
|
||||
id: document.id,
|
||||
updatedAt: document.updatedAt,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
const moveCollections = await Collection.findAll({
|
||||
where: { id: event.data.collectionIds },
|
||||
attributes: ["id", "updatedAt"],
|
||||
@@ -970,7 +974,15 @@ export default class WebsocketsProcessor {
|
||||
channels.push(`user-${event.actorId}`);
|
||||
}
|
||||
|
||||
if (document.publishedAt) {
|
||||
// Include collection/team channels for published documents that are not
|
||||
// restricted. Also include them when the privacy state just changed so that
|
||||
// clients can react to the transition (e.g. remove from or add to their view).
|
||||
const changes = (
|
||||
event as { changes?: { attributes?: Record<string, unknown> } }
|
||||
).changes;
|
||||
const privacyChanged = changes?.attributes?.isPrivate !== undefined;
|
||||
|
||||
if (document.publishedAt && (!document.isPrivate || privacyChanged)) {
|
||||
if (document.collection) {
|
||||
channels.push(
|
||||
...this.getCollectionEventChannels(event, document.collection)
|
||||
|
||||
@@ -1365,6 +1365,20 @@ router.post(
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Cannot unrestrict a child of a restricted parent
|
||||
if (document.parentDocumentId) {
|
||||
const parentDocument = await Document.unscoped().findOne({
|
||||
attributes: ["id", "isPrivate"],
|
||||
where: { id: document.parentDocumentId },
|
||||
transaction,
|
||||
});
|
||||
if (parentDocument?.isPrivate) {
|
||||
throw ValidationError(
|
||||
"Cannot remove restriction from a document whose parent is restricted"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Unrestrict: clear flag on document and all descendants
|
||||
document.isPrivate = false;
|
||||
if (childDocumentIds.length) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"Edit collection": "Edit collection",
|
||||
"Permissions": "Permissions",
|
||||
"Collection permissions": "Collection permissions",
|
||||
"Share this collection": "Share this collection",
|
||||
"Share \"{{ itemName }}\"": "Share \"{{ itemName }}\"",
|
||||
"Import document": "Import document",
|
||||
"Uploading": "Uploading",
|
||||
"Sort in sidebar": "Sort in sidebar",
|
||||
@@ -63,7 +63,6 @@
|
||||
"Unpublish": "Unpublish",
|
||||
"Unpublished {{ documentName }}": "Unpublished {{ documentName }}",
|
||||
"Subscription inherited from collection": "Subscription inherited from collection",
|
||||
"Share this document": "Share this document",
|
||||
"Download": "Download",
|
||||
"Download document": "Download document",
|
||||
"Download as Markdown": "Download as Markdown",
|
||||
@@ -427,15 +426,18 @@
|
||||
"Current version": "Current version",
|
||||
"{{userName}} edited": "{{userName}} edited",
|
||||
"Revision options": "Revision options",
|
||||
"Everyone in workspace": "Everyone in workspace",
|
||||
"Restricted": "Restricted",
|
||||
"Manage": "Manage",
|
||||
"All members": "All members",
|
||||
"Everyone in the workspace": "Everyone in the workspace",
|
||||
"Access": "Access",
|
||||
"Only invited users can access": "Only invited users can access",
|
||||
"All members of {{ itemName }}": "All members of {{ itemName }}",
|
||||
"{{ count }} member": "{{ count }} member",
|
||||
"{{ count }} member_plural": "{{ count }} members",
|
||||
"Only lowercase letters, digits and dashes allowed": "Only lowercase letters, digits and dashes allowed",
|
||||
"Sorry, this link has already been used": "Sorry, this link has already been used",
|
||||
"Public link copied to clipboard": "Public link copied to clipboard",
|
||||
"Web": "Web",
|
||||
"Publish to web": "Publish to web",
|
||||
"Allow anyone with the link to access": "Allow anyone with the link to access",
|
||||
"Publish to internet": "Publish to internet",
|
||||
"Search engine indexing": "Search engine indexing",
|
||||
@@ -459,16 +461,11 @@
|
||||
"Editor": "Editor",
|
||||
"Suggestions for invitation": "Suggestions for invitation",
|
||||
"No matches": "No matches",
|
||||
"Access managed independently": "Access managed independently",
|
||||
"Inherits access": "Inherits access",
|
||||
"Only explicitly added members can access": "Only explicitly added members can access",
|
||||
"From {{ collectionName }}": "From {{ collectionName }}",
|
||||
"From parent document": "From parent document",
|
||||
"Restrict access": "Restrict access",
|
||||
"Collection members": "Collection members",
|
||||
"Required by <2>parent</2>": "Required by <2>parent</2>",
|
||||
"Members of {{ itemName }} can access": "Members of {{ itemName }} can access",
|
||||
"Inherited from collection": "Inherited from collection",
|
||||
"Created the document": "Created the document",
|
||||
"Can view": "Can view",
|
||||
"Everyone in the collection": "Everyone in the collection",
|
||||
"You have full access": "You have full access",
|
||||
"Other people": "Other people",
|
||||
"Other workspace members may have access": "Other workspace members may have access",
|
||||
"This document may be shared with more workspace members through a parent document or collection you do not have access to": "This document may be shared with more workspace members through a parent document or collection you do not have access to",
|
||||
|
||||
Reference in new issue
Block a user