Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
updated to latest outline 0.73.1
Browse files Browse the repository at this point in the history
  • Loading branch information
r00tz committed Nov 28, 2023
1 parent f0ef2ee commit b1e2073
Show file tree
Hide file tree
Showing 328 changed files with 6,446 additions and 4,100 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ app.json
crowdin.yml
build
docker-compose.yml
fakes3
node_modules
5 changes: 5 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,8 @@ RATE_LIMITER_DURATION_WINDOW=60
# Iframely API config
# IFRAMELY_URL=
# IFRAMELY_API_KEY=

# Enable unsafe-inline in script-src CSP directive
# Setting it to true allows React dev tools add-on in
# Firefox to successfully detect the project
DEVELOPMENT_UNSAFE_INLINE_CSP=false
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ node_modules/*
npm-debug.log
stats.json
.DS_Store
fakes3/*
data/*
.idea
*.pem
*.key
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
up:
docker-compose up -d redis postgres s3
docker-compose up -d redis postgres
yarn install-local-ssl
yarn install --pure-lockfile
yarn dev:watch
Expand All @@ -8,14 +8,14 @@ build:
docker-compose build --pull outline

test:
docker-compose up -d redis postgres s3
docker-compose up -d redis postgres
yarn sequelize db:drop --env=test
yarn sequelize db:create --env=test
NODE_ENV=test yarn sequelize db:migrate --env=test
yarn test

watch:
docker-compose up -d redis postgres s3
docker-compose up -d redis postgres
yarn sequelize db:drop --env=test
yarn sequelize db:create --env=test
NODE_ENV=test yarn sequelize db:migrate --env=test
Expand Down
23 changes: 17 additions & 6 deletions app/actions/definitions/developer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ToolsIcon, TrashIcon, UserIcon } from "outline-icons";
import * as React from "react";
import stores from "~/stores";
import { toast } from "sonner";
import { createAction } from "~/actions";
import { DeveloperSection } from "~/actions/sections";
import env from "~/env";
Expand All @@ -15,7 +15,7 @@ export const clearIndexedDB = createAction({
section: DeveloperSection,
perform: async ({ t }) => {
await deleteAllDatabases();
stores.toasts.showToast(t("IndexedDB cache deleted"));
toast.message(t("IndexedDB cache deleted"));
},
});

Expand All @@ -29,20 +29,31 @@ export const createTestUsers = createAction({

try {
await client.post("/developer.create_test_users", { count });
stores.toasts.showToast(`${count} test users created`);
toast.message(`${count} test users created`);
} catch (err) {
stores.toasts.showToast(err.message, { type: "error" });
toast.error(err.message);
}
},
});

export const createToast = createAction({
name: "Create toast",
section: DeveloperSection,
visible: () => env.ENVIRONMENT === "development",
perform: async () => {
toast.message("Hello world", {
duration: 30000,
});
},
});

export const toggleDebugLogging = createAction({
name: ({ t }) => t("Toggle debug logging"),
icon: <ToolsIcon />,
section: DeveloperSection,
perform: async ({ t }) => {
Logger.debugLoggingEnabled = !Logger.debugLoggingEnabled;
stores.toasts.showToast(
toast.message(
Logger.debugLoggingEnabled
? t("Debug logging enabled")
: t("Debug logging disabled")
Expand All @@ -56,7 +67,7 @@ export const developer = createAction({
icon: <ToolsIcon />,
iconInContextMenu: false,
section: DeveloperSection,
children: [clearIndexedDB, toggleDebugLogging, createTestUsers],
children: [clearIndexedDB, toggleDebugLogging, createToast, createTestUsers],
});

export const rootDeveloperActions = [developer];
87 changes: 39 additions & 48 deletions app/actions/definitions/documents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ import {
CommentIcon,
} from "outline-icons";
import * as React from "react";
import { toast } from "sonner";
import { ExportContentType, TeamPreference } from "@shared/types";
import { getEventFiles } from "@shared/utils/files";
import DocumentDelete from "~/scenes/DocumentDelete";
import DocumentMove from "~/scenes/DocumentMove";
import DocumentPermanentDelete from "~/scenes/DocumentPermanentDelete";
import DocumentPublish from "~/scenes/DocumentPublish";
import DocumentTemplatizeDialog from "~/components/DocumentTemplatizeDialog";
import DuplicateDialog from "~/components/DuplicateDialog";
import { createAction } from "~/actions";
import { DocumentSection } from "~/actions/sections";
import env from "~/env";
Expand Down Expand Up @@ -208,13 +210,10 @@ export const publishDocument = createAction({
await document.save(undefined, {
publish: true,
});
stores.toasts.showToast(
toast.success(
t("Published {{ documentName }}", {
documentName: document.noun,
}),
{
type: "success",
}
})
);
} else if (document) {
stores.dialogs.openModal({
Expand Down Expand Up @@ -247,16 +246,17 @@ export const unpublishDocument = createAction({
return;
}

await document.unpublish();
try {
await document.unpublish();

stores.toasts.showToast(
t("Unpublished {{ documentName }}", {
documentName: document.noun,
}),
{
type: "success",
}
);
toast.success(
t("Unpublished {{ documentName }}", {
documentName: document.noun,
})
);
} catch (err) {
toast.error(err.message);
}
},
});

Expand Down Expand Up @@ -286,9 +286,7 @@ export const subscribeDocument = createAction({

await document?.subscribe();

stores.toasts.showToast(t("Subscribed to document notifications"), {
type: "success",
});
toast.success(t("Subscribed to document notifications"));
},
});

Expand Down Expand Up @@ -318,9 +316,7 @@ export const unsubscribeDocument = createAction({

await document?.unsubscribe(currentUserId);

stores.toasts.showToast(t("Unsubscribed from document notifications"), {
type: "success",
});
toast.success(t("Unsubscribed from document notifications"));
},
});

Expand Down Expand Up @@ -359,15 +355,11 @@ export const downloadDocumentAsPDF = createAction({
return;
}

const id = stores.toasts.showToast(`${t("Exporting")}…`, {
type: "loading",
timeout: 30 * 1000,
});

const id = toast.loading(`${t("Exporting")}…`);
const document = stores.documents.get(activeDocumentId);
document
?.download(ExportContentType.Pdf)
.finally(() => id && stores.toasts.hideToast(id));
.finally(() => id && toast.dismiss(id));
},
});

Expand Down Expand Up @@ -420,11 +412,19 @@ export const duplicateDocument = createAction({

const document = stores.documents.get(activeDocumentId);
invariant(document, "Document must exist");
const duped = await document.duplicate();
// when duplicating, go straight to the duplicated document content
history.push(documentPath(duped));
stores.toasts.showToast(t("Document duplicated"), {
type: "success",

stores.dialogs.openModal({
title: t("Copy document"),
isCentered: true,
content: (
<DuplicateDialog
document={document}
onSubmit={(response) => {
stores.dialogs.closeAllModals();
history.push(documentPath(response[0]));
}}
/>
),
});
},
});
Expand Down Expand Up @@ -470,12 +470,10 @@ export const pinDocumentToCollection = createAction({
const collection = stores.collections.get(activeCollectionId);

if (!collection || !location.pathname.startsWith(collection?.url)) {
stores.toasts.showToast(t("Pinned to collection"));
toast.success(t("Pinned to collection"));
}
} catch (err) {
stores.toasts.showToast(err.message, {
type: "error",
});
toast.error(err.message);
}
},
});
Expand Down Expand Up @@ -512,12 +510,10 @@ export const pinDocumentToHome = createAction({
await document?.pin();

if (location.pathname !== homePath()) {
stores.toasts.showToast(t("Pinned to team home"));
toast.success(t("Pinned to home"));
}
} catch (err) {
stores.toasts.showToast(err.message, {
type: "error",
});
toast.error(err.message);
}
},
});
Expand Down Expand Up @@ -560,7 +556,7 @@ export const importDocument = createAction({
return false;
},
perform: ({ activeCollectionId, activeDocumentId, stores }) => {
const { documents, toasts } = stores;
const { documents } = stores;
const input = document.createElement("input");
input.type = "file";
input.accept = documents.importFileTypes.join(", ");
Expand All @@ -580,9 +576,7 @@ export const importDocument = createAction({
);
history.push(document.url);
} catch (err) {
toasts.showToast(err.message, {
type: "error",
});
toast.error(err.message);
throw err;
}
};
Expand Down Expand Up @@ -703,9 +697,7 @@ export const archiveDocument = createAction({
}

await document.archive();
stores.toasts.showToast(t("Document archived"), {
type: "success",
});
toast.success(t("Document archived"));
}
},
});
Expand Down Expand Up @@ -789,8 +781,7 @@ export const openDocumentComments = createAction({
const can = stores.policies.abilities(activeDocumentId ?? "");
return (
!!activeDocumentId &&
can.read &&
!can.restore &&
can.comment &&
!!stores.auth.team?.getPreference(TeamPreference.Commenting)
);
},
Expand Down
5 changes: 2 additions & 3 deletions app/actions/definitions/revisions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import copy from "copy-to-clipboard";
import { LinkIcon, RestoreIcon } from "outline-icons";
import * as React from "react";
import { matchPath } from "react-router-dom";
import { toast } from "sonner";
import stores from "~/stores";
import { createAction } from "~/actions";
import { RevisionSection } from "~/actions/sections";
Expand Down Expand Up @@ -68,9 +69,7 @@ export const copyLinkToRevision = createAction({
copy(url, {
format: "text/plain",
onCopy: () => {
stores.toasts.showToast(t("Link copied"), {
type: "info",
});
toast.message(t("Link copied"));
},
});
},
Expand Down
5 changes: 2 additions & 3 deletions app/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import flattenDeep from "lodash/flattenDeep";
import * as React from "react";
import { toast } from "sonner";
import { Optional } from "utility-types";
import { v4 as uuidv4 } from "uuid";
import {
Expand Down Expand Up @@ -77,9 +78,7 @@ export function actionToMenuItem(
try {
action.perform?.(context);
} catch (err) {
context.stores.toasts.showToast(err.message, {
type: "error",
});
toast.error(err.message);
}
},
selected: action.selected?.(context),
Expand Down
8 changes: 5 additions & 3 deletions app/components/Authenticated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { observer } from "mobx-react";
import * as React from "react";
import { useTranslation } from "react-i18next";
import { Redirect } from "react-router-dom";
import useCurrentUser from "~/hooks/useCurrentUser";
import useStores from "~/hooks/useStores";
import { changeLanguage } from "~/utils/language";
import LoadingIndicator from "./LoadingIndicator";
Expand All @@ -13,10 +14,11 @@ type Props = {
const Authenticated = ({ children }: Props) => {
const { auth } = useStores();
const { i18n } = useTranslation();
const language = auth.user?.language;
const user = useCurrentUser({ rejectOnEmpty: false });
const language = user?.language;

// Watching for language changes here as this is the earliest point we have
// the user available and means we can start loading translations faster
// 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
React.useEffect(() => {
void changeLanguage(language, i18n);
}, [i18n, language]);
Expand Down
Loading

0 comments on commit b1e2073

Please sign in to comment.