|
1 | 1 | <script lang="ts">
|
2 | 2 | import { DefaultForgeFactory } from '$lib/forge/forgeFactory.svelte';
|
3 |
| - import { StackPublishingService } from '$lib/history/stackPublishingService'; |
4 | 3 | import { StackService } from '$lib/stacks/stackService.svelte';
|
5 | 4 | import { getContext } from '@gitbutler/shared/context';
|
6 | 5 |
|
|
16 | 15 |
|
17 | 16 | const forge = getContext(DefaultForgeFactory);
|
18 | 17 | const stackService = getContext(StackService);
|
19 |
| - const stackPublishingService = getContext(StackPublishingService); |
20 |
| -
|
21 |
| - const branch = $derived( |
22 |
| - stackId && branchName ? stackService.branchByName(projectId, stackId, branchName) : undefined |
23 |
| - ); |
24 | 18 |
|
25 | 19 | const commits = $derived(
|
26 | 20 | stackId && branchName ? stackService.commits(projectId, stackId, branchName) : undefined
|
27 | 21 | );
|
28 | 22 | const branchEmpty = $derived(commits?.current.data ? commits.current.data.length === 0 : false);
|
29 |
| - const name = $derived(branch?.current.data ? branch.current.data.name : undefined); |
30 | 23 | const prService = $derived(forge.current.prService);
|
31 | 24 | const prResult = $derived(prNumber ? prService?.get(prNumber) : undefined);
|
32 | 25 | const pr = $derived(prResult?.current.data);
|
33 | 26 |
|
34 |
| - const canPublish = stackPublishingService.canPublish; |
35 |
| - const canPublishBR = $derived(!!($canPublish && name && !reviewId)); |
36 | 27 | const canPublishPR = $derived(forge.current.authenticated && !pr);
|
37 | 28 |
|
38 |
| - const ctaLabel = $derived.by(() => { |
39 |
| - if (canPublishBR && canPublishPR) { |
40 |
| - return 'Submit for review…'; |
41 |
| - } else if (canPublishBR) { |
42 |
| - return 'Create Butler Request…'; |
43 |
| - } else if (canPublishPR) { |
44 |
| - return 'Create Pull Request…'; |
45 |
| - } |
46 |
| - return 'Submit for review…'; |
47 |
| - }); |
| 29 | + const ctaLabel = 'Create Pull Request…'; |
48 | 30 |
|
49 | 31 | export const imports = {
|
50 | 32 | get allowedToPublishPR() {
|
51 | 33 | return forge.current.authenticated;
|
52 | 34 | },
|
53 |
| - get allowedToPublishBR() { |
54 |
| - return $canPublish; |
55 |
| - }, |
56 | 35 | get branchIsEmpty() {
|
57 | 36 | return branchEmpty;
|
58 | 37 | },
|
|
65 | 44 | get reviewId() {
|
66 | 45 | return reviewId;
|
67 | 46 | },
|
68 |
| - get canPublishBR() { |
69 |
| - return canPublishBR; |
70 |
| - }, |
71 | 47 | get canPublishPR() {
|
72 | 48 | return canPublishPR;
|
73 | 49 | },
|
|
0 commit comments