mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
* fix: Current version history entry loads forever Assigning the primary key on a built Revision is a silent no-op in Sequelize, so revisions.info returned a random UUID instead of the synthetic latest id the client waits for. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix: Apply policies from fetchLatest response Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
22 lines
658 B
TypeScript
22 lines
658 B
TypeScript
export class RevisionHelper {
|
|
/**
|
|
* Get a static id for the latest revision of a document.
|
|
*
|
|
* @param documentId The document to generate an ID for.
|
|
* @returns The ID of the latest revision of the document.
|
|
*/
|
|
static latestId(documentId?: string) {
|
|
return documentId ? `latest-${documentId}` : "";
|
|
}
|
|
|
|
/**
|
|
* Extract the document id from a latest revision id.
|
|
*
|
|
* @param id The revision id to inspect.
|
|
* @returns The document id if the id is a latest revision id, otherwise undefined.
|
|
*/
|
|
static documentIdFromLatestId(id: string) {
|
|
return id.startsWith("latest-") ? id.slice("latest-".length) : undefined;
|
|
}
|
|
}
|