Browse Source

Adds account gating for cloud patch create and apply

main
Ramin Tadayon 1 year ago
parent
commit
64f9feb746
No known key found for this signature in database GPG Key ID: 79D60DDE3DFB95F5
3 changed files with 8 additions and 3 deletions
  1. +5
    -0
      src/plus/webviews/patchDetails/patchDetailsWebview.ts
  2. +2
    -2
      src/uris/deepLinks/deepLinkService.ts
  3. +1
    -1
      src/views/draftsView.ts

+ 5
- 0
src/plus/webviews/patchDetails/patchDetailsWebview.ts View File

@ -28,6 +28,7 @@ import { onIpc } from '../../../webviews/protocol';
import type { WebviewController, WebviewProvider } from '../../../webviews/webviewController';
import type { WebviewShowOptions } from '../../../webviews/webviewsController';
import { showPatchesView } from '../../drafts/actions';
import { ensureAccount } from '../../utils';
import type { ShowInCommitGraphCommandArgs } from '../graph/protocol';
import type {
ApplyPatchParams,
@ -310,6 +311,8 @@ export class PatchDetailsWebviewProvider
return;
}
if (!(await ensureAccount('A GitKraken account is required to apply cloud patches.', this.container))) return;
const changeset = this._context.draft.changesets?.[0];
if (changeset == null) return;
@ -347,6 +350,8 @@ export class PatchDetailsWebviewProvider
}
private async createDraft({ title, changesets, description }: CreatePatchParams): Promise<void> {
if (!(await ensureAccount('A GitKraken account is required to create cloud patches.', this.container))) return;
const createChanges: CreateDraftChange[] = [];
const changes = Object.entries(changesets);

+ 2
- 2
src/uris/deepLinks/deepLinkService.ts View File

@ -440,7 +440,7 @@ export class DeepLinkService implements Disposable {
if (
!(await ensureAccount(
`Account required to open ${deepLinkTypeToString(targetType)} link`,
`A GitKraken account is required to open ${deepLinkTypeToString(targetType)} links.`,
this.container,
))
) {
@ -465,7 +465,7 @@ export class DeepLinkService implements Disposable {
if (
!(await ensurePaidPlan(
`Paid plan required to open ${deepLinkTypeToString(targetType)} link`,
`A paid plan is required to open ${deepLinkTypeToString(targetType)} links.`,
this.container,
))
) {

+ 1
- 1
src/views/draftsView.ts View File

@ -110,7 +110,7 @@ export class DraftsView extends ViewBase<'drafts', DraftsViewNode, RepositoriesV
const confirm = { title: 'Delete' };
const cancel = { title: 'Cancel', isCloseAffordance: true };
const result = await window.showInformationMessage(
`Are you sure you want to delete draft '${node.draft.title}'?`,
`Are you sure you want to delete Cloud Patch '${node.draft.title}'?`,
{ modal: true },
confirm,
cancel,

Loading…
Cancel
Save