diff --git a/.env.sample b/.env.sample
index 30e1044124..e35f803405 100644
--- a/.env.sample
+++ b/.env.sample
@@ -120,6 +120,11 @@ AWS_S3_UPLOAD_BUCKET_NAME=bucket_name_here
AWS_S3_FORCE_PATH_STYLE=true
AWS_S3_ACL=private
+# Optional CloudFront CDN for attachment downloads (uploads stay on S3).
+# Requires a key pair for signed URLs; otherwise downloads fall back to S3.
+AWS_CLOUDFRONT_URL=
+AWS_CLOUDFRONT_KEY_PAIR_ID=
+AWS_CLOUDFRONT_PRIVATE_KEY=
# ––––––––––––––––––––––––––––––––––––––
# –––––––––––––––– SSL –––––––––––––––
@@ -140,6 +145,11 @@ FORCE_HTTPS=true
# and "X-Client-IP".
# PROXY_IP_HEADER=
+# Whether to trust the X-Forwarded-* headers (e.g. X-Forwarded-For,
+# X-Forwarded-Proto) set by an upstream proxy. Set to false if not
+# running behind a proxy in production.
+# PROXY_HEADERS_TRUSTED=true
+
# ––––––––––––––––––––––––––––––––––––––
# –––––––––– AUTHENTICATION ––––––––––
diff --git a/.github/workflows/calibreapp-image-actions.yml b/.github/workflows/calibreapp-image-actions.yml
index ab3d7c6689..d90251c498 100644
--- a/.github/workflows/calibreapp-image-actions.yml
+++ b/.github/workflows/calibreapp-image-actions.yml
@@ -43,7 +43,7 @@ jobs:
uses: actions/checkout@v5
- name: Compress Images
id: calibre
- uses: calibreapp/image-actions@main
+ uses: calibreapp/image-actions@3d5873ac3e7bf1a38b24d9778d8dc639d5706d8b # main
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
# For non-Pull Requests, run in compressOnly mode and we'll PR after.
@@ -54,7 +54,7 @@ jobs:
if: |
github.event_name != 'pull_request' &&
steps.calibre.outputs.markdown != ''
- uses: peter-evans/create-pull-request@v3
+ uses: peter-evans/create-pull-request@18f7dc018cc2cd597073088f7c7591b9d1c02672 # v3
with:
title: "chore: Auto Compress Images"
branch-suffix: timestamp
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7d4d299439..208f43f7e1 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -27,7 +27,7 @@ jobs:
deps: ${{ steps.filter.outputs.deps }}
steps:
- uses: actions/checkout@v5
- - uses: dorny/paths-filter@v2
+ - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2
id: filter
with:
filters: |
@@ -126,7 +126,7 @@ jobs:
run: echo "NODE_ENV=production" >> $GITHUB_ENV
- run: yarn vite:build
- name: Send bundle stats to RelativeCI
- uses: relative-ci/agent-action@v2
+ uses: relative-ci/agent-action@38328454d6a23942175eba485fca4fbb807b1f03 # v2
with:
key: ${{ secrets.RELATIVE_CI_KEY }}
token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/docker-build-check.yml b/.github/workflows/docker-build-check.yml
deleted file mode 100644
index 97b6709be5..0000000000
--- a/.github/workflows/docker-build-check.yml
+++ /dev/null
@@ -1,43 +0,0 @@
-name: Docker Build Check
-
-on:
- push:
- paths:
- - "Dockerfile"
- - "Dockerfile.base"
- pull_request:
- paths:
- - "Dockerfile"
- - "Dockerfile.base"
-
-env:
- BASE_IMAGE_NAME: outline-base
-
-jobs:
- build:
- runs-on: ubicloud-standard-8
- steps:
- - name: Checkout
- uses: actions/checkout@v5
-
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- with:
- driver: docker
-
- - name: Build base image
- uses: docker/build-push-action@v6
- with:
- context: .
- file: Dockerfile.base
- tags: ${{ env.BASE_IMAGE_NAME }}:latest
- push: false
-
- - name: Build main image
- uses: docker/build-push-action@v6
- with:
- context: .
- file: Dockerfile
- push: false
- build-args: |
- BASE_IMAGE=${{ env.BASE_IMAGE_NAME }}:latest
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index c8be149fd6..722402d1c3 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -4,6 +4,7 @@ on:
push:
tags:
- "v*"
+ workflow_dispatch:
env:
IMAGE_NAME: outlinewiki/outline
@@ -11,13 +12,13 @@ env:
jobs:
build-arm:
- runs-on: ubicloud-standard-8-arm
+ runs-on: blacksmith-8vcpu-ubuntu-2404-arm
steps:
- name: Checkout
uses: actions/checkout@v5
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v4
+ - name: Setup Blacksmith Builder
+ uses: useblacksmith/setup-docker-builder@ab5c1da94f53f5cd75c1038092aa276dddfccbba # v1
- name: Docker base meta
id: base_meta
@@ -37,7 +38,7 @@ jobs:
- name: Build and push base image
id: base_build
- uses: docker/build-push-action@v7
+ uses: useblacksmith/build-push-action@fb9e3e6a9299c78462bfadd0d93352c316adc9b8 # v2
with:
context: .
file: Dockerfile.base
@@ -45,8 +46,6 @@ jobs:
tags: ${{ env.BASE_IMAGE_NAME }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
platforms: linux/arm64
- cache-from: type=gha
- cache-to: type=gha,mode=max
pull: false
- name: Docker meta
@@ -61,7 +60,7 @@ jobs:
- name: Build and push
id: build
- uses: docker/build-push-action@v7
+ uses: useblacksmith/build-push-action@fb9e3e6a9299c78462bfadd0d93352c316adc9b8 # v2
with:
context: .
file: Dockerfile
@@ -69,8 +68,6 @@ jobs:
tags: ${{ env.IMAGE_NAME }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
platforms: linux/arm64
- cache-from: type=gha
- cache-to: type=gha,mode=max
pull: false
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE_NAME }}@${{ steps.base_build.outputs.digest }}
@@ -90,13 +87,13 @@ jobs:
retention-days: 1
build-amd:
- runs-on: ubicloud-standard-8
+ runs-on: blacksmith-8vcpu-ubuntu-2404
steps:
- name: Checkout
uses: actions/checkout@v5
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v4
+ - name: Setup Blacksmith Builder
+ uses: useblacksmith/setup-docker-builder@ab5c1da94f53f5cd75c1038092aa276dddfccbba # v1
- name: Docker base meta
id: base_meta
@@ -116,7 +113,7 @@ jobs:
- name: Build and push base image
id: base_build
- uses: docker/build-push-action@v7
+ uses: useblacksmith/build-push-action@fb9e3e6a9299c78462bfadd0d93352c316adc9b8 # v2
with:
context: .
file: Dockerfile.base
@@ -124,8 +121,6 @@ jobs:
tags: ${{ env.BASE_IMAGE_NAME }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
platforms: linux/amd64
- cache-from: type=gha
- cache-to: type=gha,mode=max
pull: false
- name: Docker meta
@@ -140,7 +135,7 @@ jobs:
- name: Build and push
id: build
- uses: docker/build-push-action@v7
+ uses: useblacksmith/build-push-action@fb9e3e6a9299c78462bfadd0d93352c316adc9b8 # v2
with:
context: .
file: Dockerfile
@@ -148,8 +143,6 @@ jobs:
tags: ${{ env.IMAGE_NAME }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
platforms: linux/amd64
- cache-from: type=gha
- cache-to: type=gha,mode=max
pull: false
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE_NAME }}@${{ steps.base_build.outputs.digest }}
@@ -169,7 +162,7 @@ jobs:
retention-days: 1
merge:
- runs-on: ubicloud-standard-8
+ runs-on: blacksmith-8vcpu-ubuntu-2404
needs:
- build-amd
- build-arm
@@ -188,8 +181,8 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v4
+ - name: Setup Blacksmith Builder
+ uses: useblacksmith/setup-docker-builder@ab5c1da94f53f5cd75c1038092aa276dddfccbba # v1
- name: Docker meta
id: meta
diff --git a/.github/workflows/update-node.yml b/.github/workflows/update-node.yml
index beef80ed35..b87a089b64 100644
--- a/.github/workflows/update-node.yml
+++ b/.github/workflows/update-node.yml
@@ -78,7 +78,7 @@ jobs:
- name: Create pull request
if: steps.check.outputs.updated == 'true'
- uses: peter-evans/create-pull-request@v7
+ uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7
with:
commit-message: "fix: Update Node.js to ${{ steps.check.outputs.latest }}"
title: "fix: Update Node.js to ${{ steps.check.outputs.latest }}"
diff --git a/.gitignore b/.gitignore
index ba5f1314d6..91db22af1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@ data/*
*.pem
*.key
*.cert
+.history
# Yarn Berry
.yarn/*
diff --git a/.oxlintrc.json b/.oxlintrc.json
index 6be149f106..1fb98f54a6 100644
--- a/.oxlintrc.json
+++ b/.oxlintrc.json
@@ -73,6 +73,23 @@
"eqeqeq": "error",
"curly": "error",
"no-console": "error",
+ "no-restricted-imports": [
+ "error",
+ {
+ "paths": [
+ {
+ "name": "prosemirror-tables",
+ "importNames": [
+ "addRowBefore",
+ "addRowAfter",
+ "addColumnBefore",
+ "addColumnAfter"
+ ],
+ "message": "Use the wrappers from shared/editor/commands/table instead, which respect the target index and place the cursor in the inserted cell."
+ }
+ ]
+ }
+ ],
"no-unused-expressions": "error",
"arrow-body-style": ["error", "as-needed"],
"react/react-in-jsx-scope": "off",
@@ -93,6 +110,7 @@
"typescript/consistent-type-imports": "error",
"typescript/restrict-template-expressions": "error",
"typescript/no-floating-promises": "error",
+ "typescript/no-useless-default-assignment": "error",
"no-unused-vars": [
"error",
{
diff --git a/Dockerfile b/Dockerfile
index 4abf0c7b97..210f3b8cf2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,7 +6,7 @@ ARG APP_PATH
WORKDIR $APP_PATH
# ---
-FROM node:24.15.0-slim AS runner
+FROM node:24.16.0-slim AS runner
LABEL org.opencontainers.image.source="https://github.com/outline/outline"
diff --git a/Dockerfile.base b/Dockerfile.base
index 4eea4c5fe0..21517f0dd3 100644
--- a/Dockerfile.base
+++ b/Dockerfile.base
@@ -1,5 +1,5 @@
ARG APP_PATH=/opt/outline
-FROM node:24.15.0 AS deps
+FROM node:24.16.0 AS deps
ARG APP_PATH
WORKDIR $APP_PATH
diff --git a/LICENSE b/LICENSE
index d7c1fe0e55..1de4bdfea8 100644
--- a/LICENSE
+++ b/LICENSE
@@ -3,7 +3,7 @@ Business Source License 1.1
Parameters
Licensor: General Outline, Inc.
-Licensed Work: Outline 1.7.1
+Licensed Work: Outline 1.8.1
The Licensed Work is (c) 2026 General Outline, Inc.
Additional Use Grant: You may make use of the Licensed Work, provided that
you may not use the Licensed Work for a Document
@@ -15,7 +15,7 @@ Additional Use Grant: You may make use of the Licensed Work, provided that
Licensed Work by creating teams and documents
controlled by such third parties.
-Change Date: 2030-05-04
+Change Date: 2030-06-06
Change License: Apache License, Version 2.0
diff --git a/app/actions/definitions/collections.tsx b/app/actions/definitions/collections.tsx
index 0f560e155b..cf8c6d9357 100644
--- a/app/actions/definitions/collections.tsx
+++ b/app/actions/definitions/collections.tsx
@@ -20,6 +20,7 @@ import {
UnsubscribeIcon,
} from "outline-icons";
import { toast } from "sonner";
+import { errToString } from "@shared/utils/error";
import Collection from "~/models/Collection";
import { CollectionEdit } from "~/components/Collection/CollectionEdit";
import { CollectionNew } from "~/components/Collection/CollectionNew";
@@ -173,7 +174,7 @@ export const importDocument = createAction({
});
history.push(document.path);
} catch (err) {
- toast.error(err.message);
+ toast.error(errToString(err));
} finally {
toast.dismiss(toastId);
}
diff --git a/app/actions/definitions/documents.tsx b/app/actions/definitions/documents.tsx
index aa33e6202d..a0b178b908 100644
--- a/app/actions/definitions/documents.tsx
+++ b/app/actions/definitions/documents.tsx
@@ -36,6 +36,7 @@ import {
OpenIcon,
} from "outline-icons";
import { toast } from "sonner";
+import { errToString } from "@shared/utils/error";
import Icon from "@shared/components/Icon";
import type { NavigationNode } from "@shared/types";
import { ExportContentType, TeamPreference } from "@shared/types";
@@ -81,6 +82,7 @@ import {
trashPath,
documentEditPath,
} from "~/utils/routeHelpers";
+import { documentBreadcrumbText } from "~/components/DocumentBreadcrumb";
import CollectionIcon from "~/components/Icons/CollectionIcon";
import type {
Action,
@@ -108,19 +110,21 @@ export const openDocument = createActionWithChildren({
shortcut: ["o", "d"],
keywords: "go to",
icon: ,
- children: ({ stores }) => {
+ children: ({ stores, t }) => {
const nodes = stores.collections.navigationNodes.reduce(
(acc, node) => [...acc, ...node.children],
[] as NavigationNode[]
);
const documents = stores.documents.orderedData;
- return uniqBy([...documents, ...nodes], "id").map((item) =>
- createInternalLinkAction({
+ return uniqBy([...documents, ...nodes], "id").map((item) => {
+ const document = stores.documents.get(item.id);
+ return createInternalLinkAction({
// Note: using url which includes the slug rather than id here to bust
// cache if the document is renamed
id: item.url,
name: item.title,
+ description: document ? documentBreadcrumbText(document, t) : undefined,
icon: item.icon ? (
node.id === document.id) ?? -1;
}
+/**
+ * Determines whether the user can create a sibling of the given document.
+ * A sibling shares the document's parent, so this mirrors the backend's
+ * create authorization: create permission on the parent document, or on the
+ * collection when the document is at the root.
+ *
+ * @param stores - the root stores.
+ * @param document - the document to create a sibling of.
+ * @returns true if the user can create a sibling.
+ */
+function canCreateSiblingDocument(
+ stores: ActionContext["stores"],
+ document: { collectionId?: string | null; parentDocumentId?: string }
+): boolean {
+ return document.parentDocumentId
+ ? stores.policies.abilities(document.parentDocumentId).createChildDocument
+ : !!document.collectionId &&
+ stores.policies.abilities(document.collectionId).createDocument;
+}
+
export const createNestedDocument = createInternalLinkAction({
name: ({ t }) => t("Nested document"),
analyticsName: "New document",
@@ -269,10 +293,14 @@ const createDocumentBefore = createInternalLinkAction({
return false;
}
const document = stores.documents.get(activeDocumentId);
- return (
- !!document?.collectionId &&
- stores.policies.abilities(currentTeamId).createDocument
- );
+ if (!document?.collectionId) {
+ return false;
+ }
+ const collection = stores.collections.get(document.collectionId);
+ if (collection?.sort.field === "title") {
+ return false;
+ }
+ return canCreateSiblingDocument(stores, document);
},
to: ({ activeDocumentId, stores, sidebarContext }) => {
const document = activeDocumentId
@@ -307,10 +335,14 @@ const createDocumentAfter = createInternalLinkAction({
return false;
}
const document = stores.documents.get(activeDocumentId);
- return (
- !!document?.collectionId &&
- stores.policies.abilities(currentTeamId).createDocument
- );
+ if (!document?.collectionId) {
+ return false;
+ }
+ const collection = stores.collections.get(document.collectionId);
+ if (collection?.sort.field === "title") {
+ return false;
+ }
+ return canCreateSiblingDocument(stores, document);
},
to: ({ activeDocumentId, stores, sidebarContext }) => {
const document = activeDocumentId
@@ -335,6 +367,18 @@ const createDocumentAfter = createInternalLinkAction({
},
});
+function isAlphabeticallySorted(
+ stores: ActionContext["stores"],
+ activeDocumentId: string
+): boolean {
+ const document = stores.documents.get(activeDocumentId);
+ if (!document?.collectionId) {
+ return false;
+ }
+ const collection = stores.collections.get(document.collectionId);
+ return collection?.sort.field === "title";
+}
+
export const createNewDocument = createActionWithChildren({
name: ({ t }) => t("New document"),
analyticsName: "New document",
@@ -342,17 +386,48 @@ export const createNewDocument = createActionWithChildren({
icon: ,
keywords: "create",
visible: ({ currentTeamId, activeDocumentId, stores }) => {
- if (!activeDocumentId) {
+ if (!activeDocumentId || !currentTeamId) {
return false;
}
-
- return (
- !!currentTeamId && stores.policies.abilities(currentTeamId).createDocument
- );
+ if (!stores.policies.abilities(currentTeamId).createDocument) {
+ return false;
+ }
+ return !isAlphabeticallySorted(stores, activeDocumentId);
},
children: [createDocumentBefore, createDocumentAfter, createNestedDocument],
});
+export const createNewDocumentInAlphabeticalCollection =
+ createInternalLinkAction({
+ name: ({ t }) => t("New document"),
+ analyticsName: "New document",
+ section: ActiveDocumentSection,
+ icon: ,
+ keywords: "create",
+ visible: ({ currentTeamId, activeDocumentId, stores }) => {
+ if (!activeDocumentId || !currentTeamId) {
+ return false;
+ }
+ if (!stores.policies.abilities(currentTeamId).createDocument) {
+ return false;
+ }
+ if (!stores.policies.abilities(activeDocumentId).createChildDocument) {
+ return false;
+ }
+ return isAlphabeticallySorted(stores, activeDocumentId);
+ },
+ to: ({ activeDocumentId, sidebarContext }) => {
+ const [pathname, search] =
+ newNestedDocumentPath(activeDocumentId).split("?");
+
+ return {
+ pathname,
+ search,
+ state: { sidebarContext },
+ };
+ },
+ });
+
export const starDocument = createAction({
name: ({ t }) => t("Star"),
analyticsName: "Star document",
@@ -1049,7 +1124,7 @@ export const importDocument = createAction({
);
history.push(document.url);
} catch (err) {
- toast.error(err.message);
+ toast.error(errToString(err));
} finally {
toast.dismiss(toastId);
}
@@ -1528,6 +1603,7 @@ export const rootDocumentActions = [
createDocument,
createDraftDocument,
createNewDocument,
+ createNewDocumentInAlphabeticalCollection,
createNestedDocument,
createTemplateFromDocument,
deleteDocument,
diff --git a/app/actions/definitions/revisions.tsx b/app/actions/definitions/revisions.tsx
index be90ec8633..fee7d43e9e 100644
--- a/app/actions/definitions/revisions.tsx
+++ b/app/actions/definitions/revisions.tsx
@@ -3,6 +3,7 @@ import { LinkIcon, RestoreIcon, TrashIcon, DownloadIcon } from "outline-icons";
import { matchPath } from "react-router-dom";
import { toast } from "sonner";
import { ExportContentType } from "@shared/types";
+import Revision from "~/models/Revision";
import stores from "~/stores";
import { createAction, createActionWithChildren } from "~/actions";
import { RevisionSection } from "~/actions/sections";
@@ -21,7 +22,7 @@ export const restoreRevision = createAction({
section: RevisionSection,
visible: ({ activeDocumentId }) =>
!!activeDocumentId && stores.policies.abilities(activeDocumentId).update,
- perform: async ({ event, location, activeDocumentId }) => {
+ perform: async ({ event, location, activeDocumentId, getActiveModel }) => {
event?.preventDefault();
if (!activeDocumentId) {
return;
@@ -30,7 +31,10 @@ export const restoreRevision = createAction({
const match = matchPath<{ revisionId: string }>(location.pathname, {
path: matchDocumentHistory,
});
- const revisionId = match?.params.revisionId;
+ const revisionId = getActiveModel(Revision)?.id ?? match?.params.revisionId;
+ if (!revisionId) {
+ return;
+ }
const document = stores.documents.get(activeDocumentId);
if (!document) {
diff --git a/app/actions/definitions/shares.tsx b/app/actions/definitions/shares.tsx
index 5ddde114e3..fb4ce8239a 100644
--- a/app/actions/definitions/shares.tsx
+++ b/app/actions/definitions/shares.tsx
@@ -1,4 +1,5 @@
import copy from "copy-to-clipboard";
+import { errToString } from "@shared/utils/error";
import type Share from "~/models/Share";
import { createAction, createInternalLinkAction } from "..";
import { ArrowIcon, CopyIcon, TrashIcon } from "outline-icons";
@@ -53,7 +54,7 @@ export const revokeShareFactory = ({
await stores.shares.revoke(share);
toast.message(t("Share link revoked"));
} catch (err) {
- toast.error(err.message);
+ toast.error(errToString(err));
}
},
});
diff --git a/app/actions/sections.ts b/app/actions/sections.ts
index fa5190d736..a192f97f46 100644
--- a/app/actions/sections.ts
+++ b/app/actions/sections.ts
@@ -13,6 +13,10 @@ ActiveCollectionSection.priority = 0.8;
export const DeveloperSection = ({ t }: ActionContext) => t("Debug");
+export const DateSection = ({ t }: ActionContext) => t("Date");
+
+DateSection.priority = 1;
+
export const DocumentSection = ({ t }: ActionContext) => t("Document");
export const SearchResultsSection = ({ t }: ActionContext) =>
diff --git a/app/components/Authenticated.tsx b/app/components/Authenticated.tsx
index 8b0ac6fcb6..9a50239400 100644
--- a/app/components/Authenticated.tsx
+++ b/app/components/Authenticated.tsx
@@ -1,5 +1,5 @@
import { observer } from "mobx-react";
-import { useEffect } from "react";
+import { useEffect, useRef } from "react";
import { useTranslation } from "react-i18next";
import { Redirect } from "react-router-dom";
import useCurrentUser from "~/hooks/useCurrentUser";
@@ -16,6 +16,7 @@ const Authenticated = ({ children }: Props) => {
const { i18n } = useTranslation();
const user = useCurrentUser({ rejectOnEmpty: false });
const language = user?.language;
+ const hasLoggedOut = useRef(false);
// Watching for language changes here as this is the earliest point we might have the user
// available and means we can start loading translations faster
@@ -23,23 +24,36 @@ const Authenticated = ({ children }: Props) => {
void changeLanguage(language, i18n);
}, [i18n, language]);
+ const shouldLogout = !auth.authenticated && !auth.isFetching;
+
+ // Passive logout when we land here without an authenticated session – note we
+ // intentionally do not revoke the server-side token, as that would clobber
+ // the session in any other tab that may have already re-authenticated.
+ useEffect(() => {
+ if (shouldLogout && !hasLoggedOut.current) {
+ hasLoggedOut.current = true;
+ void auth.logout({
+ savePath: true,
+ clearCache: false,
+ revokeToken: false,
+ });
+ }
+ }, [shouldLogout, auth]);
+
+ useEffect(() => {
+ if (auth.logoutRedirectUri) {
+ window.location.href = auth.logoutRedirectUri;
+ }
+ }, [auth.logoutRedirectUri]);
+
if (auth.authenticated) {
return children;
}
- if (auth.isFetching) {
+ if (auth.isFetching || auth.logoutRedirectUri) {
return ;
}
- void auth.logout({
- savePath: true,
- clearCache: false,
- });
-
- if (auth.logoutRedirectUri) {
- window.location.href = auth.logoutRedirectUri;
- return null;
- }
return ;
};
diff --git a/app/components/AuthenticatedLayout.tsx b/app/components/AuthenticatedLayout.tsx
index 4aa0c01ba4..6499cb5b5a 100644
--- a/app/components/AuthenticatedLayout.tsx
+++ b/app/components/AuthenticatedLayout.tsx
@@ -1,6 +1,8 @@
import { observer } from "mobx-react";
import * as React from "react";
+import { DndProvider } from "react-dnd";
import { useLocation } from "react-router-dom";
+import { EditorAwareHTML5Backend } from "~/components/EditorAwareHTML5Backend";
import ErrorSuspended from "~/scenes/Errors/ErrorSuspended";
import Layout from "~/components/Layout";
import RegisterKeyDown from "~/components/RegisterKeyDown";
@@ -104,14 +106,16 @@ const AuthenticatedLayout: React.FC = ({ children }: Props) => {
-
-
-
-
- {children}
-
-
-
+
+
+
+
+
+ {children}
+
+
+
+
diff --git a/app/components/Collaborators.tsx b/app/components/Collaborators.tsx
index 360e33ffd9..0f554e9b51 100644
--- a/app/components/Collaborators.tsx
+++ b/app/components/Collaborators.tsx
@@ -79,10 +79,10 @@ function Collaborators(props: Props) {
// Memoize ids to avoid unnecessary effect executions
const missingUserIds = useMemo(
() =>
- uniq([...document.collaboratorIds, ...Array.from(presentIds)])
+ uniq([...collaboratorIdsSet, ...presentIds])
.filter((userId) => !users.get(userId))
.sort(),
- [document.collaboratorIds, presentIds, users]
+ [collaboratorIdsSet, presentIds, users]
);
useEffect(() => {
diff --git a/app/components/Collection/CollectionEdit.tsx b/app/components/Collection/CollectionEdit.tsx
index cef1e0c80b..c85e94c9dc 100644
--- a/app/components/Collection/CollectionEdit.tsx
+++ b/app/components/Collection/CollectionEdit.tsx
@@ -1,6 +1,7 @@
import { observer } from "mobx-react";
import { useCallback } from "react";
import { toast } from "sonner";
+import { errToString } from "@shared/utils/error";
import useStores from "~/hooks/useStores";
import type { FormData } from "./CollectionForm";
import { CollectionForm } from "./CollectionForm";
@@ -23,7 +24,7 @@ export const CollectionEdit = observer(function CollectionEdit_({
await collection?.save(data);
onSubmit?.();
} catch (error) {
- toast.error(error.message);
+ toast.error(errToString(error));
}
},
[collection, onSubmit]
diff --git a/app/components/Collection/CollectionNew.tsx b/app/components/Collection/CollectionNew.tsx
index 05877b2c03..1645f93f5f 100644
--- a/app/components/Collection/CollectionNew.tsx
+++ b/app/components/Collection/CollectionNew.tsx
@@ -2,6 +2,7 @@ import { runInAction } from "mobx";
import { observer } from "mobx-react";
import { useCallback } from "react";
import { toast } from "sonner";
+import { errToString } from "@shared/utils/error";
import useStores from "~/hooks/useStores";
import history from "~/utils/history";
import type { FormData } from "./CollectionForm";
@@ -26,7 +27,7 @@ export const CollectionNew = observer(function CollectionNew_({
onSubmit?.();
history.push(collection.path);
} catch (error) {
- toast.error(error.message);
+ toast.error(errToString(error));
}
},
[collections, onSubmit]
diff --git a/app/components/CommandBar/useRecentDocumentActions.tsx b/app/components/CommandBar/useRecentDocumentActions.tsx
index a104350439..bb109fc0fd 100644
--- a/app/components/CommandBar/useRecentDocumentActions.tsx
+++ b/app/components/CommandBar/useRecentDocumentActions.tsx
@@ -1,13 +1,16 @@
import { DocumentIcon } from "outline-icons";
import { useMemo } from "react";
+import { useTranslation } from "react-i18next";
import Icon from "@shared/components/Icon";
import { createInternalLinkAction } from "~/actions";
import { RecentSection } from "~/actions/sections";
+import { documentBreadcrumbText } from "~/components/DocumentBreadcrumb";
import useStores from "~/hooks/useStores";
import { documentPath } from "~/utils/routeHelpers";
const useRecentDocumentActions = (count = 6) => {
const { documents, ui } = useStores();
+ const { t } = useTranslation();
return useMemo(
() =>
@@ -19,6 +22,7 @@ const useRecentDocumentActions = (count = 6) => {
name: item.titleWithDefault,
analyticsName: "Recently viewed document",
section: RecentSection,
+ description: documentBreadcrumbText(item, t),
icon: item.icon ? (
{
to: documentPath(item),
})
),
- [count, ui.activeDocumentId, documents.recentlyViewed]
+ [count, ui.activeDocumentId, documents.recentlyViewed, t]
);
};
diff --git a/app/components/CommentDeleteDialog.tsx b/app/components/CommentDeleteDialog.tsx
index 7808c022b4..61c8faa899 100644
--- a/app/components/CommentDeleteDialog.tsx
+++ b/app/components/CommentDeleteDialog.tsx
@@ -1,6 +1,7 @@
import { observer } from "mobx-react";
import { useTranslation, Trans } from "react-i18next";
import { toast } from "sonner";
+import { errToString } from "@shared/utils/error";
import type Comment from "~/models/Comment";
import ConfirmationDialog from "~/components/ConfirmationDialog";
import Text from "~/components/Text";
@@ -21,7 +22,7 @@ function CommentDeleteDialog({ comment, onSubmit }: Props) {
await comment.delete();
onSubmit?.();
} catch (err) {
- toast.error(err.message);
+ toast.error(errToString(err));
}
};
diff --git a/app/components/ConfirmMoveDialog.tsx b/app/components/ConfirmMoveDialog.tsx
index 75d13f186a..55401670a8 100644
--- a/app/components/ConfirmMoveDialog.tsx
+++ b/app/components/ConfirmMoveDialog.tsx
@@ -1,6 +1,7 @@
import { observer } from "mobx-react";
import { Trans, useTranslation } from "react-i18next";
import { toast } from "sonner";
+import { errToString } from "@shared/utils/error";
import type { NavigationNode } from "@shared/types";
import { CollectionPermission } from "@shared/types";
import type Collection from "~/models/Collection";
@@ -50,7 +51,7 @@ function ConfirmMoveDialog({ collection, item, ...rest }: Props) {
)
);
} else {
- toast.error(err.message);
+ toast.error(errToString(err));
}
} finally {
dialogs.closeAllModals();
diff --git a/app/components/ConfirmationDialog.tsx b/app/components/ConfirmationDialog.tsx
index 6dc927d312..75e702f9d9 100644
--- a/app/components/ConfirmationDialog.tsx
+++ b/app/components/ConfirmationDialog.tsx
@@ -2,6 +2,7 @@ import { observer } from "mobx-react";
import * as React from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
+import { errToString } from "@shared/utils/error";
import Button from "~/components/Button";
import Flex from "~/components/Flex";
import Text from "~/components/Text";
@@ -44,7 +45,7 @@ const ConfirmationDialog: React.FC = ({
}
dialogs.closeAllModals();
} catch (err) {
- toast.error(err.message);
+ toast.error(errToString(err));
} finally {
setIsSaving(false);
}
diff --git a/app/components/DefaultCollectionInputSelect.tsx b/app/components/DefaultCollectionInputSelect.tsx
index e46edac00a..caac5675eb 100644
--- a/app/components/DefaultCollectionInputSelect.tsx
+++ b/app/components/DefaultCollectionInputSelect.tsx
@@ -8,6 +8,7 @@ import { getLuminance } from "polished";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
+import { toError } from "@shared/utils/error";
import Icon from "@shared/components/Icon";
import { colorPalette } from "@shared/utils/collections";
import type { Option } from "~/components/InputSelect";
@@ -27,7 +28,7 @@ const DefaultCollectionInputSelect = observer(
const { t } = useTranslation();
const { collections, ui } = useStores();
const [fetching, setFetching] = useState(false);
- const [fetchError, setFetchError] = useState();
+ const [fetchError, setFetchError] = useState();
React.useEffect(() => {
async function fetchData() {
@@ -41,7 +42,7 @@ const DefaultCollectionInputSelect = observer(
toast.error(
t("Collections could not be loaded, please reload the app")
);
- setFetchError(error);
+ setFetchError(toError(error));
} finally {
setFetching(false);
}
diff --git a/app/components/DesktopEventHandler.tsx b/app/components/DesktopEventHandler.tsx
index dbfac609b1..28ca23249c 100644
--- a/app/components/DesktopEventHandler.tsx
+++ b/app/components/DesktopEventHandler.tsx
@@ -15,7 +15,7 @@ export default function DesktopEventHandler() {
const hasDisabledUpdateMessage = useRef(false);
useEffect(() => {
- Desktop.bridge?.redirect((path: string, replace = false) => {
+ Desktop.bridge?.redirect((path: string, replace: boolean) => {
if (replace) {
history.replace(path);
} else {
diff --git a/app/components/DocumentBreadcrumb.tsx b/app/components/DocumentBreadcrumb.tsx
index c3da07a972..aa53d86efc 100644
--- a/app/components/DocumentBreadcrumb.tsx
+++ b/app/components/DocumentBreadcrumb.tsx
@@ -1,10 +1,10 @@
+import type { TFunction } from "i18next";
import { observer } from "mobx-react";
import { ArchiveIcon, GoToIcon, TrashIcon } from "outline-icons";
import * as React from "react";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import Icon from "@shared/components/Icon";
-import type { NavigationNode } from "@shared/types";
import type Collection from "~/models/Collection";
import type Document from "~/models/Document";
import Breadcrumb from "~/components/Breadcrumb";
@@ -20,6 +20,56 @@ import { archivePath, trashPath } from "~/utils/routeHelpers";
import { createInternalLinkAction } from "~/actions";
import { ActiveDocumentSection } from "~/actions/sections";
+/**
+ * Returns the breadcrumb parts leading up to a document, separating the
+ * (possibly deleted) collection label from ancestor document titles. The
+ * document itself is not included.
+ *
+ * @param document - the document to compute the breadcrumb for.
+ * @param t - translation function for fallback titles.
+ * @returns the collection label and ancestor titles.
+ */
+export function documentBreadcrumbParts(
+ document: Document,
+ t: TFunction
+): { collection: string | undefined; ancestors: string[] } {
+ let collectionLabel: string | undefined;
+ if (document.isCollectionDeleted) {
+ collectionLabel = t("Deleted Collection");
+ } else if (document.collection?.name) {
+ collectionLabel = document.collection.name;
+ }
+
+ return {
+ collection: collectionLabel,
+ ancestors: document.pathTo
+ .slice(0, -1)
+ .map((node) => node.title || t("Untitled")),
+ };
+}
+
+/**
+ * Returns the breadcrumb path leading up to a document as a plain text
+ * string. Includes the collection name (or "Deleted Collection" fallback)
+ * and any ancestor document titles, slash-separated.
+ *
+ * @param document - the document to compute the breadcrumb for.
+ * @param t - translation function for fallback titles.
+ * @returns the breadcrumb as a slash-separated string, or undefined if the
+ * document has no resolvable parent context.
+ */
+export function documentBreadcrumbText(
+ document: Document,
+ t: TFunction
+): string | undefined {
+ const parts = documentBreadcrumbParts(document, t);
+ const segments = [
+ ...(parts.collection ? [parts.collection] : []),
+ ...parts.ancestors,
+ ];
+ return segments.length ? segments.join(" / ") : undefined;
+}
+
type Props = {
children?: React.ReactNode;
document: Document;
@@ -147,22 +197,25 @@ function DocumentBreadcrumb(
return <>>;
}
- const slicedPath = reverse
- ? path.slice(depth && -depth)
- : path.slice(0, depth);
+ const { collection: collectionLabel, ancestors: ancestorLabels } =
+ documentBreadcrumbParts(document, t);
+
+ const slicedAncestors = reverse
+ ? ancestorLabels.slice(depth && -depth)
+ : ancestorLabels.slice(0, depth);
const showCollection =
- collection &&
- (!reverse || depth === undefined || slicedPath.length < depth);
+ !!collectionLabel &&
+ (!reverse || depth === undefined || slicedAncestors.length < depth);
return (
<>
- {showCollection && collection.name}
- {slicedPath.map((node: NavigationNode, index: number) => (
-
+ {showCollection && collectionLabel}
+ {slicedAncestors.map((label, index) => (
+
{showCollection && }
- {node.title || t("Untitled")}
- {!showCollection && index !== slicedPath.length - 1 && (
+ {label}
+ {!showCollection && index !== slicedAncestors.length - 1 && (
)}
diff --git a/app/components/DocumentContext.tsx b/app/components/DocumentContext.tsx
index e37ec76d6d..20a8d2ac82 100644
--- a/app/components/DocumentContext.tsx
+++ b/app/components/DocumentContext.tsx
@@ -31,6 +31,10 @@ class DocumentContext {
@action
setDocument = (document: Document) => {
+ // Reset the focused comment when navigating between documents
+ if (this.document && this.document.id !== document.id) {
+ this.focusedCommentId = null;
+ }
this.document = document;
this.updateState();
};
diff --git a/app/components/DocumentExplorer/DocumentCopy.tsx b/app/components/DocumentExplorer/DocumentCopy.tsx
index 0210a6a078..fe36f738e3 100644
--- a/app/components/DocumentExplorer/DocumentCopy.tsx
+++ b/app/components/DocumentExplorer/DocumentCopy.tsx
@@ -40,8 +40,8 @@ function DocumentCopy({ document, onSubmit }: Props) {
return nodes;
}, [policies, collectionTrees]);
- const copy = async () => {
- if (!selectedPath) {
+ const copy = async (path = selectedPath) => {
+ if (!path) {
toast.message(t("Select a location to copy"));
return;
}
@@ -52,10 +52,8 @@ function DocumentCopy({ document, onSubmit }: Props) {
publish,
recursive,
title: document.title,
- collectionId: selectedPath.collectionId,
- ...(selectedPath.type === "document"
- ? { parentDocumentId: selectedPath.id }
- : {}),
+ collectionId: path.collectionId,
+ ...(path.type === "document" ? { parentDocumentId: path.id } : {}),
});
toast.success(t("Document copied"));
@@ -111,7 +109,7 @@ function DocumentCopy({ document, onSubmit }: Props) {
t("Select a location to copy")
)}
-