JSON to client (#5553)
This commit is contained in:
@@ -81,7 +81,7 @@ export default class WebsocketsProcessor {
|
||||
if (!document) {
|
||||
return;
|
||||
}
|
||||
const data = await presentDocument(document);
|
||||
const data = await presentDocument(undefined, document);
|
||||
const channels = await this.getDocumentEventChannels(event, document);
|
||||
return socketio.to(channels).emit(event.name, data);
|
||||
}
|
||||
@@ -452,7 +452,7 @@ export default class WebsocketsProcessor {
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await presentNotification(notification);
|
||||
const data = await presentNotification(undefined, notification);
|
||||
return socketio.to(`user-${event.userId}`).emit(event.name, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ export default class CleanupDeletedDocumentsTask extends BaseTask<Props> {
|
||||
`Permanently destroying upto ${limit} documents older than 30 days…`
|
||||
);
|
||||
const documents = await Document.scope("withDrafts").findAll({
|
||||
attributes: ["id", "teamId", "text", "deletedAt"],
|
||||
attributes: ["id", "teamId", "content", "text", "deletedAt"],
|
||||
where: {
|
||||
deletedAt: {
|
||||
[Op.lt]: subDays(new Date(), 30),
|
||||
|
||||
@@ -2,7 +2,7 @@ import { NotificationEventType } from "@shared/types";
|
||||
import subscriptionCreator from "@server/commands/subscriptionCreator";
|
||||
import { Comment, Document, Notification, User } from "@server/models";
|
||||
import NotificationHelper from "@server/models/helpers/NotificationHelper";
|
||||
import ProsemirrorHelper from "@server/models/helpers/ProsemirrorHelper";
|
||||
import { ProsemirrorHelper } from "@server/models/helpers/ProsemirrorHelper";
|
||||
import { sequelize } from "@server/storage/database";
|
||||
import { CommentEvent } from "@server/types";
|
||||
import BaseTask, { TaskPriority } from "./BaseTask";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NotificationEventType } from "@shared/types";
|
||||
import { Comment, Document, Notification, User } from "@server/models";
|
||||
import ProsemirrorHelper from "@server/models/helpers/ProsemirrorHelper";
|
||||
import { ProsemirrorHelper } from "@server/models/helpers/ProsemirrorHelper";
|
||||
import { CommentEvent, CommentUpdateEvent } from "@server/types";
|
||||
import BaseTask, { TaskPriority } from "./BaseTask";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NotificationEventType } from "@shared/types";
|
||||
import { createSubscriptionsForDocument } from "@server/commands/subscriptionCreator";
|
||||
import { Document, Notification, User } from "@server/models";
|
||||
import DocumentHelper from "@server/models/helpers/DocumentHelper";
|
||||
import { DocumentHelper } from "@server/models/helpers/DocumentHelper";
|
||||
import NotificationHelper from "@server/models/helpers/NotificationHelper";
|
||||
import { DocumentEvent } from "@server/types";
|
||||
import BaseTask, { TaskPriority } from "./BaseTask";
|
||||
|
||||
@@ -6,7 +6,7 @@ import Logger from "@server/logging/Logger";
|
||||
import { Collection } from "@server/models";
|
||||
import Attachment from "@server/models/Attachment";
|
||||
import Document from "@server/models/Document";
|
||||
import DocumentHelper from "@server/models/helpers/DocumentHelper";
|
||||
import { DocumentHelper } from "@server/models/helpers/DocumentHelper";
|
||||
import ZipHelper from "@server/utils/ZipHelper";
|
||||
import { serializeFilename } from "@server/utils/fs";
|
||||
import parseAttachmentIds from "@server/utils/parseAttachmentIds";
|
||||
|
||||
@@ -10,12 +10,12 @@ import {
|
||||
Document,
|
||||
FileOperation,
|
||||
} from "@server/models";
|
||||
import DocumentHelper from "@server/models/helpers/DocumentHelper";
|
||||
import { DocumentHelper } from "@server/models/helpers/DocumentHelper";
|
||||
import { ProsemirrorHelper } from "@server/models/helpers/ProsemirrorHelper";
|
||||
import { presentAttachment, presentCollection } from "@server/presenters";
|
||||
import { CollectionJSONExport, JSONExportMetadata } from "@server/types";
|
||||
import ZipHelper from "@server/utils/ZipHelper";
|
||||
import { serializeFilename } from "@server/utils/fs";
|
||||
import parseAttachmentIds from "@server/utils/parseAttachmentIds";
|
||||
import packageJson from "../../../package.json";
|
||||
import ExportTask from "./ExportTask";
|
||||
|
||||
@@ -87,7 +87,9 @@ export default class ExportJSONTask extends ExportTask {
|
||||
? await Attachment.findAll({
|
||||
where: {
|
||||
teamId: document.teamId,
|
||||
id: parseAttachmentIds(document.text),
|
||||
id: ProsemirrorHelper.parseAttachmentIds(
|
||||
DocumentHelper.toProsemirror(document)
|
||||
),
|
||||
},
|
||||
})
|
||||
: [];
|
||||
|
||||
@@ -6,7 +6,7 @@ import { createSubscriptionsForDocument } from "@server/commands/subscriptionCre
|
||||
import env from "@server/env";
|
||||
import Logger from "@server/logging/Logger";
|
||||
import { Document, Revision, Notification, User, View } from "@server/models";
|
||||
import DocumentHelper from "@server/models/helpers/DocumentHelper";
|
||||
import { DocumentHelper } from "@server/models/helpers/DocumentHelper";
|
||||
import NotificationHelper from "@server/models/helpers/NotificationHelper";
|
||||
import { RevisionEvent } from "@server/types";
|
||||
import BaseTask, { TaskPriority } from "./BaseTask";
|
||||
|
||||
Reference in New Issue
Block a user