@@ -24,6 +24,7 @@ import type { GitFileChangeShape } from '../../git/models/fileChange';
24
24
import type { Issue } from '../../git/models/issue' ;
25
25
import type { GitPausedOperationStatus } from '../../git/models/pausedOperationStatus' ;
26
26
import type { PullRequest } from '../../git/models/pullRequest' ;
27
+ import type { GitBranchReference } from '../../git/models/reference' ;
27
28
import { RemoteResourceType } from '../../git/models/remoteResource' ;
28
29
import type { Repository , RepositoryFileSystemChangeEvent } from '../../git/models/repository' ;
29
30
import { RepositoryChange , RepositoryChangeComparisonMode } from '../../git/models/repository' ;
@@ -67,6 +68,7 @@ import type { IpcMessage } from '../protocol';
67
68
import type { WebviewHost , WebviewProvider , WebviewShowingArgs } from '../webviewProvider' ;
68
69
import type { WebviewShowOptions } from '../webviewsController' ;
69
70
import type {
71
+ BranchIssueLink ,
70
72
BranchRef ,
71
73
CollapseSectionParams ,
72
74
DidChangeRepositoriesParams ,
@@ -332,6 +334,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
332
334
registerCommand ( 'gitlens.home.continuePausedOperation' , this . continuePausedOperation , this ) ,
333
335
registerCommand ( 'gitlens.home.abortPausedOperation' , this . abortPausedOperation , this ) ,
334
336
registerCommand ( 'gitlens.home.openRebaseEditor' , this . openRebaseEditor , this ) ,
337
+ registerCommand ( 'gitlens.home.unlinkIssue' , this . unlinkIssue , this ) ,
335
338
] ;
336
339
}
337
340
@@ -545,6 +548,35 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
545
548
} ) ;
546
549
}
547
550
551
+ private async unlinkIssue ( { issue, reference } : { reference : GitBranchReference ; issue : BranchIssueLink } ) {
552
+ const skipPrompt = this . container . storage . get ( 'autolinks:branches:ignore:skipPrompt' ) || undefined ;
553
+ const item =
554
+ skipPrompt ??
555
+ ( await window . showWarningMessage (
556
+ `This action will unlink the issue ${ issue . url } from the branch ${ reference . name } forever` ,
557
+ {
558
+ modal : true ,
559
+ } ,
560
+ `OK` ,
561
+ `OK, Don't ask again` ,
562
+ ) ) ;
563
+ if ( ! item ) {
564
+ return ;
565
+ }
566
+ if ( item === `OK, Don't ask again` ) {
567
+ void this . container . storage . store ( 'autolinks:branches:ignore:skipPrompt' , true ) ;
568
+ }
569
+ const prev = this . container . storage . get ( 'autolinks:branches:ignore' ) ?? { } ;
570
+ const refId = reference . id ?? `${ reference . repoPath } /${ reference . remote } /${ reference . ref } ` ;
571
+ await this . container . storage
572
+ . store ( 'autolinks:branches:ignore' , {
573
+ ...prev ,
574
+ [ refId ] : [ ...( prev [ refId ] ?? [ ] ) , issue . url ] ,
575
+ } )
576
+ . catch ( ) ;
577
+ void this . host . notify ( DidChangeRepositoryWip , undefined ) ;
578
+ }
579
+
548
580
private async createCloudPatch ( ref : BranchRef ) {
549
581
const status = await this . container . git . status ( ref . repoPath ) . getStatus ( ) ;
550
582
if ( status == null ) return ;
@@ -1357,11 +1389,12 @@ function getOverviewBranchesCore(
1357
1389
for ( const branch of branches ) {
1358
1390
const wt = worktreesByBranch . get ( branch . id ) ;
1359
1391
1392
+ const ignored = container . storage . get ( 'autolinks:branches:ignore' ) ?. [ branch . id ] ;
1360
1393
const timestamp = branch . date ?. getTime ( ) ;
1361
1394
1362
1395
if ( isPro === true ) {
1363
1396
prPromises . set ( branch . id , getPullRequestInfo ( container , branch , launchpadPromise ) ) ;
1364
- autolinkPromises . set ( branch . id , branch . getEnrichedAutolinks ( ) ) ;
1397
+ autolinkPromises . set ( branch . id , branch . getEnrichedAutolinks ( ignored ) ) ;
1365
1398
issuePromises . set (
1366
1399
branch . id ,
1367
1400
getAssociatedIssuesForBranch ( container , branch ) . then ( issues => issues . value ) ,
@@ -1472,6 +1505,8 @@ async function getAutolinkIssuesInfo(links: Map<string, EnrichedAutolink> | unde
1472
1505
title : issue . title ,
1473
1506
url : issue . url ,
1474
1507
state : issue . state ,
1508
+ type : issue . type ,
1509
+ isAutolink : true ,
1475
1510
} ;
1476
1511
} ) ,
1477
1512
) ;
0 commit comments