Merge branch 'main' of github.com:outline/outline into feat/dropdown-pagination

This commit is contained in:
Tom Moor committed 2022-07-17 21:00:37 +01:00
commit 832eb20a10
6 files changed
+46 -33

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
The Outline team takes security bugs seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
To report a security issue, email [hello@getoutline.com](mailto:hello@getoutline.com) and include the word "SECURITY" in the subject line.
If you discover a security vulnerability in outline, please disclose it via [our huntr page](https://huntr.dev/repos/${owner}/${repo}/). Bounty eligibility, CVE assignment, response times and past reports are all there.
The Outline team will send a response indicating the next steps in handling your report. After the initial reply to your report you will be kept informed of the progress towards a fix and full announcement.
+10 -18
View File
@@ -2,11 +2,7 @@ import Router from "koa-router";
import { v4 as uuidv4 } from "uuid";
import { bytesToHumanReadable } from "@shared/utils/files";
import { sequelize } from "@server/database/sequelize";
import {
AuthorizationError,
NotFoundError,
ValidationError,
} from "@server/errors";
import { AuthorizationError, ValidationError } from "@server/errors";
import auth from "@server/middlewares/authentication";
import { Attachment, Document, Event } from "@server/models";
import { authorize } from "@server/policies";
@@ -15,7 +11,7 @@ import {
publicS3Endpoint,
getSignedUrl,
} from "@server/utils/s3";
import { assertPresent } from "@server/validation";
import { assertPresent, assertUuid } from "@server/validation";
const router = new Router();
const AWS_S3_ACL = process.env.AWS_S3_ACL || "private";
@@ -113,13 +109,11 @@ router.post("attachments.create", auth(), async (ctx) => {
router.post("attachments.delete", auth(), async (ctx) => {
const { id } = ctx.body;
assertPresent(id, "id is required");
assertUuid(id, "id is required");
const { user } = ctx.state;
const attachment = await Attachment.findByPk(id);
if (!attachment) {
throw NotFoundError();
}
const attachment = await Attachment.findByPk(id, {
rejectOnEmpty: true,
});
if (attachment.documentId) {
const document = await Document.findByPk(attachment.documentId, {
@@ -144,13 +138,11 @@ router.post("attachments.delete", auth(), async (ctx) => {
router.post("attachments.redirect", auth(), async (ctx) => {
const { id } = ctx.body;
assertPresent(id, "id is required");
assertUuid(id, "id is required");
const { user } = ctx.state;
const attachment = await Attachment.findByPk(id);
if (!attachment) {
throw NotFoundError();
}
const attachment = await Attachment.findByPk(id, {
rejectOnEmpty: true,
});
if (attachment.isPrivate) {
if (attachment.teamId !== user.teamId) {
+5 -8
View File
@@ -1,23 +1,20 @@
import Router from "koa-router";
import { NotFoundError } from "@server/errors";
import auth from "@server/middlewares/authentication";
import { Document, Revision } from "@server/models";
import { authorize } from "@server/policies";
import { presentRevision } from "@server/presenters";
import { assertPresent, assertSort } from "@server/validation";
import { assertPresent, assertSort, assertUuid } from "@server/validation";
import pagination from "./middlewares/pagination";
const router = new Router();
router.post("revisions.info", auth(), async (ctx) => {
const { id } = ctx.body;
assertPresent(id, "id is required");
assertUuid(id, "id is required");
const { user } = ctx.state;
const revision = await Revision.findByPk(id);
if (!revision) {
throw NotFoundError();
}
const revision = await Revision.findByPk(id, {
rejectOnEmpty: true,
});
const document = await Document.findByPk(revision.documentId, {
userId: user.id,
+4 -1
View File
@@ -2,7 +2,7 @@ import Router from "koa-router";
import auth from "@server/middlewares/authentication";
import { SearchQuery } from "@server/models";
import { presentSearchQuery } from "@server/presenters";
import { assertPresent } from "@server/validation";
import { assertPresent, assertUuid } from "@server/validation";
import pagination from "./middlewares/pagination";
const router = new Router();
@@ -28,6 +28,9 @@ router.post("searches.list", auth(), pagination(), async (ctx) => {
router.post("searches.delete", auth(), async (ctx) => {
const { id, query } = ctx.body;
assertPresent(id || query, "id or query is required");
if (id) {
assertUuid(id, "id is must be a uuid");
}
const { user } = ctx.state;
await SearchQuery.destroy({
+22 -1
View File
@@ -12,6 +12,8 @@ import {
Selection,
TextSelection,
Transaction,
Plugin,
PluginKey,
} from "prosemirror-state";
import refractor from "refractor/core";
import bash from "refractor/lang/bash";
@@ -283,7 +285,26 @@ export default class CodeFence extends Node {
};
get plugins() {
return [Prism({ name: this.name }), Mermaid({ name: this.name })];
return [
Prism({ name: this.name }),
Mermaid({ name: this.name }),
new Plugin({
key: new PluginKey("triple-click"),
props: {
handleDOMEvents: {
mousedown(view, event) {
const {
selection: { $from, $to },
} = view.state;
if (!isInCode(view.state)) {
return false;
}
return $from.sameParent($to) && event.detail === 3;
},
},
},
}),
];
}
inputRules({ type }: { type: NodeType }) {
+4 -4
View File
@@ -35,9 +35,9 @@ export default class Emoji extends Node {
selectable: false,
parseDOM: [
{
tag: "span.emoji",
tag: "strong.emoji",
preserveWhitespace: "full",
getAttrs: (dom: HTMLDivElement) => ({
getAttrs: (dom: HTMLElement) => ({
"data-name": dom.dataset.name,
}),
},
@@ -48,7 +48,7 @@ export default class Emoji extends Node {
nameToEmoji[node.attrs["data-name"]]
);
return [
"span",
"strong",
{
class: `emoji ${node.attrs["data-name"]}`,
"data-name": node.attrs["data-name"],
@@ -57,7 +57,7 @@ export default class Emoji extends Node {
];
}
const text = document.createTextNode(`:${node.attrs["data-name"]}:`);
return ["span", { class: "emoji" }, text];
return ["strong", { class: "emoji" }, text];
},
toPlainText: (node) => nameToEmoji[node.attrs["data-name"]],
};