mirror of
https://github.com/outline/outline.git
synced 2026-11-21 13:34:02 +03:00
Merge remote-tracking branch 'upstream/master' into feature/reordering-documents-in-collection
This commit is contained in:
commit
2ae30a36cd
28 files changed
+294
-136
No files matched your search
@@ -1 +0,0 @@
|
||||
yarn flow
|
||||
@@ -1,50 +0,0 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { fadeIn } from 'shared/styles/animations';
|
||||
import embeds from '../../embeds';
|
||||
|
||||
export default class Embed extends React.Component<*> {
|
||||
get url(): string {
|
||||
return this.props.attrs.href;
|
||||
}
|
||||
|
||||
getMatchResults(): ?{ component: *, matches: string[] } {
|
||||
const keys = Object.keys(embeds);
|
||||
|
||||
for (const key of keys) {
|
||||
const component = embeds[key];
|
||||
|
||||
for (const host of component.ENABLED) {
|
||||
const matches = this.url.match(host);
|
||||
if (matches) return { component, matches };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const result = this.getMatchResults();
|
||||
if (!result) return null;
|
||||
|
||||
const { isSelected, children } = this.props;
|
||||
const { component, matches } = result;
|
||||
const EmbedComponent = component;
|
||||
|
||||
return (
|
||||
<Container contentEditable={false} isSelected={isSelected}>
|
||||
<EmbedComponent matches={matches} url={this.url} />
|
||||
{children}
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const Container = styled.div`
|
||||
text-align: center;
|
||||
animation: ${fadeIn} 500ms ease-in-out;
|
||||
line-height: 0;
|
||||
|
||||
border-radius: 3px;
|
||||
box-shadow: ${props =>
|
||||
props.isSelected ? `0 0 0 2px ${props.theme.selected}` : 'none'};
|
||||
`;
|
||||
@@ -59,6 +59,7 @@ class Layout extends React.Component<Props> {
|
||||
|
||||
@keydown('shift+/')
|
||||
handleOpenKeyboardShortcuts() {
|
||||
if (this.props.ui.editMode) return;
|
||||
this.keyboardShortcutsOpen = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import * as React from 'react';
|
||||
import { observer, inject } from 'mobx-react';
|
||||
import type { RouterHistory } from 'react-router-dom';
|
||||
import styled from 'styled-components';
|
||||
import {
|
||||
DocumentIcon,
|
||||
EmailIcon,
|
||||
@@ -13,6 +14,7 @@ import {
|
||||
LinkIcon,
|
||||
TeamIcon,
|
||||
BulletedListIcon,
|
||||
ExpandedIcon,
|
||||
} from 'outline-icons';
|
||||
import ZapierIcon from './icons/Zapier';
|
||||
import SlackIcon from './icons/Slack';
|
||||
@@ -49,7 +51,11 @@ class SettingsSidebar extends React.Component<Props> {
|
||||
return (
|
||||
<Sidebar>
|
||||
<HeaderBlock
|
||||
subheading="◄ Return to App"
|
||||
subheading={
|
||||
<ReturnToApp align="center">
|
||||
<BackIcon /> Return to App
|
||||
</ReturnToApp>
|
||||
}
|
||||
teamName={team.name}
|
||||
logoUrl={team.avatarUrl}
|
||||
onClick={this.returnToDashboard}
|
||||
@@ -145,4 +151,13 @@ class SettingsSidebar extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const BackIcon = styled(ExpandedIcon)`
|
||||
transform: rotate(90deg);
|
||||
margin-left: -8px;
|
||||
`;
|
||||
|
||||
const ReturnToApp = styled(Flex)`
|
||||
height: 16px;
|
||||
`;
|
||||
|
||||
export default inject('auth', 'policies')(SettingsSidebar);
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
import Header from './Header';
|
||||
import SidebarLink from './SidebarLink';
|
||||
import CollectionLink from './CollectionLink';
|
||||
import CollectionsLoading from './CollectionsLoading';
|
||||
import Fade from 'components/Fade';
|
||||
|
||||
import CollectionsStore from 'stores/CollectionsStore';
|
||||
@@ -152,8 +153,7 @@ class Collections extends React.Component<Props, State> {
|
||||
const { draggingDocumentId } = this.state;
|
||||
|
||||
const content = (
|
||||
<Flex column>
|
||||
<Header>Collections</Header>
|
||||
<React.Fragment>
|
||||
<DragDropContext
|
||||
onDragStart={this.handleDragStart}
|
||||
onDragEnd={this.reorder}
|
||||
@@ -178,12 +178,22 @@ class Collections extends React.Component<Props, State> {
|
||||
label="New collection…"
|
||||
exact
|
||||
/>
|
||||
</Flex>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
return (
|
||||
collections.isLoaded &&
|
||||
(this.isPreloaded ? content : <Fade>{content}</Fade>)
|
||||
<Flex column>
|
||||
<Header>Collections</Header>
|
||||
{collections.isLoaded ? (
|
||||
this.isPreloaded ? (
|
||||
content
|
||||
) : (
|
||||
<Fade>{content}</Fade>
|
||||
)
|
||||
) : (
|
||||
<CollectionsLoading />
|
||||
)}
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import Mask from 'components/Mask';
|
||||
|
||||
function CollectionsLoading() {
|
||||
return (
|
||||
<Wrapper>
|
||||
<Mask />
|
||||
<Mask />
|
||||
<Mask />
|
||||
</Wrapper>
|
||||
);
|
||||
}
|
||||
|
||||
const Wrapper = styled.div`
|
||||
margin: 4px 16px;
|
||||
width: 75%;
|
||||
`;
|
||||
|
||||
export default CollectionsLoading;
|
||||
@@ -128,22 +128,6 @@ class SocketProvider extends React.Component<Props> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Move this to the document scene once data loading
|
||||
// has been refactored to be friendlier there.
|
||||
if (
|
||||
auth.user &&
|
||||
documentId === ui.activeDocumentId &&
|
||||
document.updatedBy.id !== auth.user.id
|
||||
) {
|
||||
ui.showToast(`Document updated by ${document.updatedBy.name}`, {
|
||||
timeout: 30 * 1000,
|
||||
action: {
|
||||
text: 'Refresh',
|
||||
onClick: () => window.location.reload(),
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-2
@@ -31,10 +31,21 @@ class Gist extends React.Component<Props> {
|
||||
const iframe = this.iframeNode;
|
||||
if (!iframe) return;
|
||||
|
||||
// We need to add some temporary content to the iframe for the document
|
||||
// to be available, otherwise it's undefined on first load
|
||||
const temp = document.getElementById('gist');
|
||||
if (temp) {
|
||||
temp.innerHTML = '';
|
||||
temp.appendChild(iframe);
|
||||
}
|
||||
|
||||
// $FlowFixMe
|
||||
let doc = iframe.document;
|
||||
if (iframe.contentDocument) doc = iframe.contentDocument;
|
||||
else if (iframe.contentWindow) doc = iframe.contentWindow.document;
|
||||
if (iframe.contentDocument) {
|
||||
doc = iframe.contentDocument;
|
||||
} else if (iframe.contentWindow) {
|
||||
doc = iframe.contentWindow.document;
|
||||
}
|
||||
|
||||
const gistLink = `https://gist.github.com/${id}.js`;
|
||||
const gistScript = `<script type="text/javascript" src="${
|
||||
|
||||
@@ -67,16 +67,17 @@ class UserMenu extends React.Component<Props> {
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
{!user.isSuspended &&
|
||||
(user.isAdmin ? (
|
||||
<DropdownMenuItem onClick={this.handleDemote}>
|
||||
Make {user.name} a member…
|
||||
</DropdownMenuItem>
|
||||
) : (
|
||||
{user.isAdmin && (
|
||||
<DropdownMenuItem onClick={this.handleDemote}>
|
||||
Make {user.name} a member…
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
{!user.isAdmin &&
|
||||
!user.isSuspended && (
|
||||
<DropdownMenuItem onClick={this.handlePromote}>
|
||||
Make {user.name} an admin…
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
)}
|
||||
{!user.lastActiveAt && (
|
||||
<DropdownMenuItem onClick={this.handleRevoke}>
|
||||
Revoke invite…
|
||||
|
||||
+17
-8
@@ -10,7 +10,12 @@ import Revision from 'models/Revision';
|
||||
import User from 'models/User';
|
||||
import DocumentsStore from 'stores/DocumentsStore';
|
||||
|
||||
type SaveOptions = { publish?: boolean, done?: boolean, autosave?: boolean };
|
||||
type SaveOptions = {
|
||||
publish?: boolean,
|
||||
done?: boolean,
|
||||
autosave?: boolean,
|
||||
lastRevision?: number,
|
||||
};
|
||||
|
||||
export default class Document extends BaseModel {
|
||||
@observable isSaving: boolean = false;
|
||||
@@ -181,13 +186,17 @@ export default class Document extends BaseModel {
|
||||
});
|
||||
}
|
||||
|
||||
return await this.store.update({
|
||||
id: this.id,
|
||||
title: this.title,
|
||||
text: this.text,
|
||||
lastRevision: this.revision,
|
||||
...options,
|
||||
});
|
||||
if (options.lastRevision) {
|
||||
return await this.store.update({
|
||||
id: this.id,
|
||||
title: this.title,
|
||||
text: this.text,
|
||||
lastRevision: options.lastRevision,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
||||
throw new Error('Attempting to update without a lastRevision');
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import DocumentsStore from 'stores/DocumentsStore';
|
||||
import PoliciesStore from 'stores/PoliciesStore';
|
||||
import RevisionsStore from 'stores/RevisionsStore';
|
||||
import UiStore from 'stores/UiStore';
|
||||
import { OfflineError } from 'utils/errors';
|
||||
|
||||
type Props = {|
|
||||
match: Object,
|
||||
@@ -47,7 +48,7 @@ class DataLoader extends React.Component<Props> {
|
||||
if (this.document) {
|
||||
const policy = this.props.policies.get(this.document.id);
|
||||
|
||||
if (!policy) {
|
||||
if (!policy && !this.error) {
|
||||
this.loadDocument();
|
||||
}
|
||||
}
|
||||
@@ -131,7 +132,11 @@ class DataLoader extends React.Component<Props> {
|
||||
const { location, policies, ui } = this.props;
|
||||
|
||||
if (this.error) {
|
||||
return navigator.onLine ? <Error404 /> : <ErrorOffline />;
|
||||
return this.error instanceof OfflineError ? (
|
||||
<ErrorOffline />
|
||||
) : (
|
||||
<Error404 />
|
||||
);
|
||||
}
|
||||
|
||||
const document = this.document;
|
||||
|
||||
@@ -14,12 +14,13 @@ import {
|
||||
documentMoveUrl,
|
||||
documentHistoryUrl,
|
||||
documentEditUrl,
|
||||
documentUrl,
|
||||
} from 'utils/routeHelpers';
|
||||
import { emojiToUrl } from 'utils/emoji';
|
||||
|
||||
import Header from './Header';
|
||||
import DocumentMove from './DocumentMove';
|
||||
import KeyboardShortcuts from './KeyboardShortcuts';
|
||||
import KeyboardShortcutsButton from './KeyboardShortcutsButton';
|
||||
import References from './References';
|
||||
import Loading from './Loading';
|
||||
import Container from './Container';
|
||||
@@ -74,11 +75,13 @@ class DocumentScene extends React.Component<Props> {
|
||||
@observable isDirty: boolean = false;
|
||||
@observable isEmpty: boolean = true;
|
||||
@observable moveModalOpen: boolean = false;
|
||||
@observable lastRevision: number;
|
||||
@observable title: string;
|
||||
|
||||
constructor(props) {
|
||||
super();
|
||||
this.title = props.document.title;
|
||||
this.lastRevision = props.document.revision;
|
||||
this.loadEditor();
|
||||
}
|
||||
|
||||
@@ -86,6 +89,29 @@ class DocumentScene extends React.Component<Props> {
|
||||
this.updateIsDirty();
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const { auth, document } = this.props;
|
||||
|
||||
if (this.props.readOnly) {
|
||||
this.lastRevision = document.revision;
|
||||
} else if (prevProps.document.revision !== this.lastRevision) {
|
||||
if (auth.user && document.updatedBy.id !== auth.user.id) {
|
||||
this.props.ui.showToast(
|
||||
`Document updated by ${document.updatedBy.name}`,
|
||||
{
|
||||
timeout: 30 * 1000,
|
||||
action: {
|
||||
text: 'Reload',
|
||||
onClick: () => {
|
||||
window.location.href = documentUrl(document);
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keydown('m')
|
||||
goToMove(ev) {
|
||||
if (!this.props.readOnly) return;
|
||||
@@ -174,7 +200,11 @@ class DocumentScene extends React.Component<Props> {
|
||||
handleOpenMoveModal = () => (this.moveModalOpen = true);
|
||||
|
||||
onSave = async (
|
||||
options: { done?: boolean, publish?: boolean, autosave?: boolean } = {}
|
||||
options: {
|
||||
done?: boolean,
|
||||
publish?: boolean,
|
||||
autosave?: boolean,
|
||||
} = {}
|
||||
) => {
|
||||
const { document } = this.props;
|
||||
|
||||
@@ -202,17 +232,27 @@ class DocumentScene extends React.Component<Props> {
|
||||
let isNew = !document.id;
|
||||
this.isSaving = true;
|
||||
this.isPublishing = !!options.publish;
|
||||
const savedDocument = await document.save(options);
|
||||
this.isDirty = false;
|
||||
this.isSaving = false;
|
||||
this.isPublishing = false;
|
||||
|
||||
if (options.done) {
|
||||
this.props.history.push(savedDocument.url);
|
||||
this.props.ui.setActiveDocument(savedDocument);
|
||||
} else if (isNew) {
|
||||
this.props.history.push(documentEditUrl(savedDocument));
|
||||
this.props.ui.setActiveDocument(savedDocument);
|
||||
try {
|
||||
const savedDocument = await document.save({
|
||||
...options,
|
||||
lastRevision: this.lastRevision,
|
||||
});
|
||||
this.isDirty = false;
|
||||
this.lastRevision = savedDocument.revision;
|
||||
|
||||
if (options.done) {
|
||||
this.props.history.push(savedDocument.url);
|
||||
this.props.ui.setActiveDocument(savedDocument);
|
||||
} else if (isNew) {
|
||||
this.props.history.push(documentEditUrl(savedDocument));
|
||||
this.props.ui.setActiveDocument(savedDocument);
|
||||
}
|
||||
} catch (err) {
|
||||
this.props.ui.showToast(err.message);
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
this.isPublishing = false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -281,6 +321,7 @@ class DocumentScene extends React.Component<Props> {
|
||||
return <Loading location={location} />;
|
||||
}
|
||||
|
||||
const value = revision ? revision.text : document.text;
|
||||
const disableEmbeds =
|
||||
(team && team.documentEmbeds === false) || document.embedsDisabled;
|
||||
|
||||
@@ -378,7 +419,8 @@ class DocumentScene extends React.Component<Props> {
|
||||
key={disableEmbeds ? 'embeds-disabled' : 'embeds-enabled'}
|
||||
title={revision ? revision.title : this.title}
|
||||
document={document}
|
||||
defaultValue={revision ? revision.text : document.text}
|
||||
value={readOnly ? value : undefined}
|
||||
defaultValue={value}
|
||||
disableEmbeds={disableEmbeds}
|
||||
onImageUploadStart={this.onImageUploadStart}
|
||||
onImageUploadStop={this.onImageUploadStop}
|
||||
@@ -405,7 +447,7 @@ class DocumentScene extends React.Component<Props> {
|
||||
</MaxWidth>
|
||||
</Container>
|
||||
</Container>
|
||||
{isShare ? <Branding /> : <KeyboardShortcuts />}
|
||||
{isShare ? <Branding /> : <KeyboardShortcutsButton />}
|
||||
</ErrorBoundary>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -53,9 +53,7 @@ class DocumentEditor extends React.Component<Props> {
|
||||
render() {
|
||||
const { document, title, onChangeTitle, isDraft, readOnly } = this.props;
|
||||
const { emoji } = parseTitle(title);
|
||||
const startsWithEmojiAndSpace = !!(
|
||||
emoji && title.match(new RegExp(`^${emoji}\\s`))
|
||||
);
|
||||
const startsWithEmojiAndSpace = !!(emoji && title.startsWith(`${emoji} `));
|
||||
|
||||
return (
|
||||
<Flex auto column>
|
||||
|
||||
File renamed without changes.
@@ -45,7 +45,9 @@ class UserProfile extends React.Component<Props> {
|
||||
>
|
||||
<Flex column>
|
||||
<Meta>
|
||||
{isCurrentUser ? 'You joined' : 'Joined'}{' '}
|
||||
{isCurrentUser
|
||||
? 'You joined'
|
||||
: user.lastActiveAt ? 'Joined' : 'Invited'}{' '}
|
||||
{distanceInWordsToNow(new Date(user.createdAt))} ago.
|
||||
{user.isAdmin && (
|
||||
<StyledBadge admin={user.isAdmin}>Admin</StyledBadge>
|
||||
|
||||
+20
-4
@@ -4,6 +4,14 @@ import { map, trim } from 'lodash';
|
||||
import invariant from 'invariant';
|
||||
import stores from 'stores';
|
||||
import download from './download';
|
||||
import {
|
||||
AuthorizationError,
|
||||
NetworkError,
|
||||
NotFoundError,
|
||||
OfflineError,
|
||||
RequestError,
|
||||
UpdateRequiredError,
|
||||
} from './errors';
|
||||
|
||||
type Options = {
|
||||
baseUrl?: string,
|
||||
@@ -62,9 +70,9 @@ class ApiClient {
|
||||
});
|
||||
} catch (err) {
|
||||
if (window.navigator.onLine) {
|
||||
throw new Error('A network error occurred, try again?');
|
||||
throw new NetworkError('A network error occurred, try again?');
|
||||
} else {
|
||||
throw new Error('No internet connection available');
|
||||
throw new OfflineError('No internet connection available');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,10 +112,18 @@ class ApiClient {
|
||||
|
||||
if (response.status === 400 && error.error === 'editor_update_required') {
|
||||
window.location.reload(true);
|
||||
return;
|
||||
throw new UpdateRequiredError(error.message);
|
||||
}
|
||||
|
||||
throw error;
|
||||
if (response.status === 403) {
|
||||
throw new AuthorizationError(error.message);
|
||||
}
|
||||
|
||||
if (response.status === 404) {
|
||||
throw new NotFoundError(error.message);
|
||||
}
|
||||
|
||||
throw new RequestError(error.message);
|
||||
};
|
||||
|
||||
get = (path: string, data: ?Object, options?: Object) => {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// @flow
|
||||
import ExtendableError from 'es6-error';
|
||||
|
||||
export class AuthorizationError extends ExtendableError {}
|
||||
export class NetworkError extends ExtendableError {}
|
||||
export class NotFoundError extends ExtendableError {}
|
||||
export class OfflineError extends ExtendableError {}
|
||||
export class RequestError extends ExtendableError {}
|
||||
export class UpdateRequiredError extends ExtendableError {}
|
||||
+2
-1
@@ -86,6 +86,7 @@
|
||||
"debug": "^4.1.1",
|
||||
"dotenv": "^4.0.0",
|
||||
"emoji-regex": "^6.5.1",
|
||||
"es6-error": "^4.1.1",
|
||||
"exports-loader": "^0.6.4",
|
||||
"file-loader": "^1.1.6",
|
||||
"flow-typed": "^2.6.2",
|
||||
@@ -141,7 +142,7 @@
|
||||
"react-portal": "^4.0.0",
|
||||
"react-router-dom": "^5.1.2",
|
||||
"react-waypoint": "^9.0.2",
|
||||
"rich-markdown-editor": "^10.0.2-1",
|
||||
"rich-markdown-editor": "^10.0.3-1",
|
||||
"sequelize": "^5.21.1",
|
||||
"sequelize-cli": "^5.5.0",
|
||||
"sequelize-encrypted": "^0.1.0",
|
||||
|
||||
@@ -40,7 +40,11 @@ router.post('groups.list', auth(), pagination(), async ctx => {
|
||||
data: {
|
||||
groups: groups.map(presentGroup),
|
||||
groupMemberships: groups
|
||||
.map(g => g.groupMemberships.slice(0, MAX_AVATAR_DISPLAY))
|
||||
.map(g =>
|
||||
g.groupMemberships
|
||||
.filter(membership => !!membership.user)
|
||||
.slice(0, MAX_AVATAR_DISPLAY)
|
||||
)
|
||||
.flat()
|
||||
.map(presentGroupMembership),
|
||||
},
|
||||
|
||||
@@ -144,6 +144,33 @@ describe('#groups.list', async () => {
|
||||
expect(body.policies.length).toEqual(1);
|
||||
expect(body.policies[0].abilities.read).toEqual(true);
|
||||
});
|
||||
|
||||
it('should return groups when membership user is deleted', async () => {
|
||||
const me = await buildUser();
|
||||
const user = await buildUser({ teamId: me.teamId });
|
||||
const group = await buildGroup({ teamId: user.teamId });
|
||||
|
||||
await group.addUser(user, { through: { createdById: me.id } });
|
||||
await group.addUser(me, { through: { createdById: me.id } });
|
||||
await user.destroy();
|
||||
|
||||
const res = await server.post('/api/groups.list', {
|
||||
body: { token: me.getJwtToken() },
|
||||
});
|
||||
const body = await res.json();
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
|
||||
expect(body.data['groups'].length).toEqual(1);
|
||||
expect(body.data['groups'][0].id).toEqual(group.id);
|
||||
|
||||
expect(body.data['groupMemberships'].length).toEqual(1);
|
||||
expect(body.data['groupMemberships'][0].groupId).toEqual(group.id);
|
||||
expect(body.data['groupMemberships'][0].user.id).toEqual(me.id);
|
||||
|
||||
expect(body.policies.length).toEqual(1);
|
||||
expect(body.policies[0].abilities.read).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#groups.info', async () => {
|
||||
@@ -273,10 +300,14 @@ describe('#groups.memberships', async () => {
|
||||
it('should allow filtering members in group by name', async () => {
|
||||
const user = await buildUser();
|
||||
const user2 = await buildUser({ name: "Won't find" });
|
||||
const user3 = await buildUser({ teamId: user.teamId, name: 'Deleted' });
|
||||
const group = await buildGroup({ teamId: user.teamId });
|
||||
|
||||
await group.addUser(user, { through: { createdById: user.id } });
|
||||
await group.addUser(user2, { through: { createdById: user.id } });
|
||||
await group.addUser(user3, { through: { createdById: user.id } });
|
||||
|
||||
await user3.destroy();
|
||||
|
||||
const res = await server.post('/api/groups.memberships', {
|
||||
body: {
|
||||
|
||||
@@ -93,6 +93,13 @@ if (process.env.SENTRY_DSN) {
|
||||
dsn: process.env.SENTRY_DSN,
|
||||
environment: process.env.NODE_ENV,
|
||||
maxBreadcrumbs: 0,
|
||||
ignoreErrors: [
|
||||
// emitted by Koa when bots attempt to snoop on paths such as wp-admin
|
||||
// or the user submits a bad request. These are expected in normal running
|
||||
// of the application
|
||||
'BadRequestError',
|
||||
'UnauthorizedError',
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+11
-1
@@ -1,4 +1,5 @@
|
||||
// @flow
|
||||
import * as Sentry from '@sentry/node';
|
||||
import { createQueue } from './utils/queue';
|
||||
import services from './services';
|
||||
|
||||
@@ -144,7 +145,16 @@ serviceEventsQueue.process(async job => {
|
||||
const service = services[event.service];
|
||||
|
||||
if (service.on) {
|
||||
service.on(event);
|
||||
service.on(event).catch(error => {
|
||||
if (process.env.SENTRY_DSN) {
|
||||
Sentry.withScope(function(scope) {
|
||||
scope.setExtra('event', event);
|
||||
Sentry.captureException(error);
|
||||
});
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -254,6 +254,12 @@ type SearchOptions = {
|
||||
includeDrafts?: boolean,
|
||||
};
|
||||
|
||||
function escape(query: string): string {
|
||||
// replace "\" with escaped "\\" because sequelize.escape doesn't do it
|
||||
// https://github.com/sequelize/sequelize/issues/2950
|
||||
return sequelize.escape(query).replace('\\', '\\\\');
|
||||
}
|
||||
|
||||
Document.searchForTeam = async (
|
||||
team,
|
||||
query,
|
||||
@@ -261,7 +267,7 @@ Document.searchForTeam = async (
|
||||
): Promise<SearchResult[]> => {
|
||||
const limit = options.limit || 15;
|
||||
const offset = options.offset || 0;
|
||||
const wildcardQuery = `${sequelize.escape(query)}:*`;
|
||||
const wildcardQuery = `${escape(query)}:*`;
|
||||
const collectionIds = await team.collectionIds();
|
||||
|
||||
// If the team has access no public collections then shortcircuit the rest of this
|
||||
@@ -327,7 +333,7 @@ Document.searchForUser = async (
|
||||
): Promise<SearchResult[]> => {
|
||||
const limit = options.limit || 15;
|
||||
const offset = options.offset || 0;
|
||||
const wildcardQuery = `${sequelize.escape(query)}:*`;
|
||||
const wildcardQuery = `${escape(query)}:*`;
|
||||
|
||||
// Ensure we're filtering by the users accessible collections. If
|
||||
// collectionId is passed as an option it is assumed that the authorization
|
||||
|
||||
@@ -40,7 +40,16 @@
|
||||
>
|
||||
</script>
|
||||
<script>
|
||||
Sentry.init({ dsn: '<%= SENTRY_DSN %>' });
|
||||
Sentry.init({
|
||||
dsn: '<%= SENTRY_DSN %>',
|
||||
ignoreErrors: [
|
||||
'AuthorizationError',
|
||||
'NetworkError',
|
||||
'NotFoundError',
|
||||
'OfflineError',
|
||||
'UpdateRequiredError',
|
||||
],
|
||||
});
|
||||
|
||||
if (window.localStorage.getItem("theme") === "dark") {
|
||||
window.document.querySelector('#root').style.background = "#111319";
|
||||
|
||||
@@ -10,8 +10,6 @@ import {
|
||||
import Layout from '../pages/components/Layout';
|
||||
import { light } from '../../shared/styles/theme';
|
||||
|
||||
const sheet = new ServerStyleSheet();
|
||||
|
||||
export default function renderpage(ctx: Object, children: React.Node) {
|
||||
let sessions = {};
|
||||
try {
|
||||
@@ -22,6 +20,7 @@ export default function renderpage(ctx: Object, children: React.Node) {
|
||||
console.error(`Sessions cookie could not be parsed: ${err}`);
|
||||
}
|
||||
|
||||
const sheet = new ServerStyleSheet();
|
||||
const loggedIn = !!(
|
||||
ctx.cookies.get('accessToken') || Object.keys(sessions).length
|
||||
);
|
||||
|
||||
@@ -149,7 +149,7 @@ export const dark = {
|
||||
text: colors.almostWhite,
|
||||
textSecondary: lighten(0.1, colors.slate),
|
||||
textTertiary: colors.slate,
|
||||
placeholder: darken(0.5, '#B1BECC'),
|
||||
placeholder: colors.slateDark,
|
||||
|
||||
sidebarBackground: colors.veryDarkBlue,
|
||||
sidebarItemBackground: colors.veryDarkBlue,
|
||||
|
||||
@@ -91,7 +91,9 @@ export const RESERVED_SUBDOMAINS = [
|
||||
'imap',
|
||||
'localhost',
|
||||
'mail',
|
||||
'marketing',
|
||||
'mobile',
|
||||
'new',
|
||||
'news',
|
||||
'newsletter',
|
||||
'ns1',
|
||||
@@ -106,6 +108,7 @@ export const RESERVED_SUBDOMAINS = [
|
||||
'setup',
|
||||
'signin',
|
||||
'signup',
|
||||
'site',
|
||||
'smtp',
|
||||
'support',
|
||||
'status',
|
||||
@@ -116,6 +119,7 @@ export const RESERVED_SUBDOMAINS = [
|
||||
'updates',
|
||||
'ws',
|
||||
'wss',
|
||||
'web',
|
||||
'websockets',
|
||||
'www',
|
||||
'www1',
|
||||
|
||||
@@ -3342,6 +3342,11 @@ es5-ext@^0.10.35, es5-ext@^0.10.45, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@
|
||||
es6-symbol "~3.1.3"
|
||||
next-tick "~1.0.0"
|
||||
|
||||
es6-error@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d"
|
||||
integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==
|
||||
|
||||
es6-iterator@^2.0.3, es6-iterator@~2.0.1, es6-iterator@~2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7"
|
||||
@@ -7760,7 +7765,7 @@ prosemirror-inputrules@^1.1.2:
|
||||
prosemirror-state "^1.0.0"
|
||||
prosemirror-transform "^1.0.0"
|
||||
|
||||
prosemirror-keymap@^1.0.0, prosemirror-keymap@^1.1.2, prosemirror-keymap@^1.1.3:
|
||||
prosemirror-keymap@^1.0.0, prosemirror-keymap@^1.1.2, prosemirror-keymap@^1.1.4:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/prosemirror-keymap/-/prosemirror-keymap-1.1.4.tgz#8b481bf8389a5ac40d38dbd67ec3da2c7eac6a6d"
|
||||
integrity sha512-Al8cVUOnDFL4gcI5IDlG6xbZ0aOD/i3B17VT+1JbHWDguCgt/lBHVTHUBcKvvbSg6+q/W4Nj1Fu6bwZSca3xjg==
|
||||
@@ -7776,10 +7781,10 @@ prosemirror-markdown@^1.4.4:
|
||||
markdown-it "^10.0.0"
|
||||
prosemirror-model "^1.0.0"
|
||||
|
||||
prosemirror-model@^1.0.0, prosemirror-model@^1.1.0, prosemirror-model@^1.8.1, prosemirror-model@^1.9.1:
|
||||
version "1.9.1"
|
||||
resolved "https://registry.yarnpkg.com/prosemirror-model/-/prosemirror-model-1.9.1.tgz#8c08cf556f593c5f015548d2c1a6825661df087f"
|
||||
integrity sha512-Qblh8pm1c7Ll64sYLauwwzjimo/tFg1zW3Q3IWhKRhvfOEgRKqa6dC5pRrAa+XHOIjBFEYrqbi52J5bqA2dV8Q==
|
||||
prosemirror-model@^1.0.0, prosemirror-model@^1.1.0, prosemirror-model@^1.10.0, prosemirror-model@^1.8.1:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/prosemirror-model/-/prosemirror-model-1.10.0.tgz#bb1101732bccacf336e23a36a8b045b865025fa2"
|
||||
integrity sha512-xTMbbO2q4abs5lJdeRvk/SrftNfZlMdvChKziTiK+OKtP8LkQI8uw39u4S5zqyflrmW3Or6+qnyFPf1p4v2u1g==
|
||||
dependencies:
|
||||
orderedmap "^1.1.0"
|
||||
|
||||
@@ -7822,7 +7827,7 @@ prosemirror-utils@^0.9.6:
|
||||
resolved "https://registry.yarnpkg.com/prosemirror-utils/-/prosemirror-utils-0.9.6.tgz#3d97bd85897e3b535555867dc95a51399116a973"
|
||||
integrity sha512-UC+j9hQQ1POYfMc5p7UFxBTptRiGPR7Kkmbl3jVvU8VgQbkI89tR/GK+3QYC8n+VvBZrtAoCrJItNhWSxX3slA==
|
||||
|
||||
prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.13.3, prosemirror-view@^1.14.9:
|
||||
prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.13.3:
|
||||
version "1.14.9"
|
||||
resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.14.9.tgz#9efb96f362caaa0c25f0676f226202f48b500fb4"
|
||||
integrity sha512-b2aMFJR9mHyKc0Zvk3lNS7Fw12LqQXIiEJj1oAMjr/cEJpPIbGNpb2z7+c0fyGA/41F+fnEyKSZiTwpgno37iw==
|
||||
@@ -7831,6 +7836,15 @@ prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.13.3, pros
|
||||
prosemirror-state "^1.0.0"
|
||||
prosemirror-transform "^1.1.0"
|
||||
|
||||
prosemirror-view@^1.14.11:
|
||||
version "1.14.11"
|
||||
resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.14.11.tgz#cb1fa9910ac5c834fd8bb15598d4ed6609465a5c"
|
||||
integrity sha512-zcd6saORBuYkn2bVh9Nqu0BfSPE4xl2ct3VpWTu/BUShs/8hlIpckxz/9+NwcDqgYc+AgBgo/XcL0HNcLdxvjw==
|
||||
dependencies:
|
||||
prosemirror-model "^1.1.0"
|
||||
prosemirror-state "^1.0.0"
|
||||
prosemirror-transform "^1.1.0"
|
||||
|
||||
proto-list@~1.2.1:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
|
||||
@@ -8637,10 +8651,10 @@ retry-as-promised@^3.2.0:
|
||||
dependencies:
|
||||
any-promise "^1.3.0"
|
||||
|
||||
rich-markdown-editor@^10.0.2-1:
|
||||
version "10.0.2-1"
|
||||
resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-10.0.2-1.tgz#ed385c628fa326c723e93493c32978aa8672c1df"
|
||||
integrity sha512-bKDJAr+ULiMSS2sS2GQGe2JbYYmVif5ZqFvBv3cG4UyFaIHzfqO+m/usD8zTknGj4wOUGv8/7ErdDKJabHkWTQ==
|
||||
rich-markdown-editor@^10.0.3-1:
|
||||
version "10.0.3-1"
|
||||
resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-10.0.3-1.tgz#a0a07900d2c4c37b4f017382c22a9937f7e90e2a"
|
||||
integrity sha512-p59ydbcmQbz2coeDa1LMnZcm0UtAG3d5FExbmLFue85mBZKqrMyQMo0LokW7MZoXTw0KeIvUeFM8inKYc8qdaA==
|
||||
dependencies:
|
||||
copy-to-clipboard "^3.0.8"
|
||||
lodash "^4.17.11"
|
||||
@@ -8652,14 +8666,14 @@ rich-markdown-editor@^10.0.2-1:
|
||||
prosemirror-gapcursor "^1.1.5"
|
||||
prosemirror-history "^1.1.3"
|
||||
prosemirror-inputrules "^1.1.2"
|
||||
prosemirror-keymap "^1.1.3"
|
||||
prosemirror-keymap "^1.1.4"
|
||||
prosemirror-markdown "^1.4.4"
|
||||
prosemirror-model "^1.9.1"
|
||||
prosemirror-model "^1.10.0"
|
||||
prosemirror-schema-list "^1.1.2"
|
||||
prosemirror-state "^1.3.3"
|
||||
prosemirror-tables "^1.0.0"
|
||||
prosemirror-utils "^0.9.6"
|
||||
prosemirror-view "^1.14.9"
|
||||
prosemirror-view "^1.14.11"
|
||||
react-medium-image-zoom "^3.0.16"
|
||||
react-portal "^4.2.1"
|
||||
refractor "^2.10.1"
|
||||
|
||||
Reference in new issue
Block a user