Skip to content

Commit

Permalink
add publish method back to avoid a breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
madsrasmussen committed Dec 13, 2024
1 parent e8409b3 commit ca3486a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import type { UmbSubmittableWorkspaceContext } from './submittable-workspace-con

export interface UmbPublishableWorkspaceContext extends UmbSubmittableWorkspaceContext {
saveAndPublish(): Promise<void>;
publish(): Promise<void>;
unpublish(): Promise<void>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export class UmbDocumentPublishingWorkspaceContext extends UmbContextBase<UmbDoc
]);
}

public async publish() {
throw new Error('Method not implemented.');
}

/**
* Save and publish the document
* @returns {Promise<void>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@ export class UmbDocumentWorkspaceContext
previewWindow?.focus();
}

Check notice on line 256 in src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v15/dev)

✅ No longer an issue: Complex Method

UmbDocumentWorkspaceContext.handleSaveAndPublish is no longer above the threshold for cyclomatic complexity
public async publish() {
new UmbDeprecation({
deprecated: 'The Publish method on the UMB_DOCUMENT_WORKSPACE_CONTEXT is deprecated.',
removeInVersion: '17',
solution: 'Use the Publish method on the UMB_DOCUMENT_PUBLISHING_WORKSPACE_CONTEXT instead.',
}).warn();
if (!this.#publishingContext) throw new Error('Publishing context is missing');
this.#publishingContext.publish();
}

/**
* Save the document and publish it.
* @deprecated Will be removed in v17. Use the UMB_DOCUMENT_PUBLISHING_WORKSPACE_CONTEXT instead.
Expand Down

0 comments on commit ca3486a

Please sign in to comment.