mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
1a893b0e45
Adds group sync from external authentication providers, allowing team group memberships to be automatically managed based on provider data on sign-in in the future.
32 lines
771 B
TypeScript
32 lines
771 B
TypeScript
import { createContext } from "@server/context";
|
|
import type { User, Document } from "@server/models";
|
|
import { Revision } from "@server/models";
|
|
import { sequelize } from "@server/storage/database";
|
|
import type { DocumentEvent, RevisionEvent } from "@server/types";
|
|
|
|
export default async function revisionCreator({
|
|
event,
|
|
document,
|
|
collaboratorIds,
|
|
user,
|
|
}: {
|
|
event: DocumentEvent | RevisionEvent;
|
|
document: Document;
|
|
collaboratorIds: string[];
|
|
user: User;
|
|
}) {
|
|
return sequelize.transaction(
|
|
async (transaction) =>
|
|
await Revision.createFromDocument(
|
|
createContext({
|
|
user,
|
|
authType: event.authType,
|
|
ip: event.ip,
|
|
transaction,
|
|
}),
|
|
document,
|
|
collaboratorIds
|
|
)
|
|
);
|
|
}
|