Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 905f3e1

Browse files
committed
Dynamically enable changes link
1 parent f469c14 commit 905f3e1

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/GitHub.App/ViewModels/PullRequestDetailViewModel.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,9 @@ public async Task Load(string remoteRepositoryOwner, IPullRequestModel pullReque
452452
}
453453

454454
var syncSubmodulesEnabled = await pullRequestsService.IsSyncSubmodulesRequired(LocalRepository);
455+
var changesEnabled = !await pullRequestsService.IsWorkingDirectoryClean(LocalRepository);
455456

456-
UpdateState = new UpdateCommandState(divergence, pullEnabled, pushEnabled, pullToolTip, pushToolTip, syncSubmodulesEnabled);
457+
UpdateState = new UpdateCommandState(divergence, pullEnabled, pushEnabled, pullToolTip, pushToolTip, syncSubmodulesEnabled, changesEnabled);
457458
CheckoutState = null;
458459
}
459460
else
@@ -687,7 +688,8 @@ public UpdateCommandState(
687688
bool pushEnabled,
688689
string pullToolTip,
689690
string pushToolTip,
690-
bool syncSubmodulesEnabled)
691+
bool syncSubmodulesEnabled,
692+
bool changesEnabled)
691693
{
692694
CommitsAhead = divergence.AheadBy ?? 0;
693695
CommitsBehind = divergence.BehindBy ?? 0;
@@ -696,6 +698,7 @@ public UpdateCommandState(
696698
PullToolTip = pullToolTip;
697699
PushToolTip = pushToolTip;
698700
SyncSubmodulesEnabled = syncSubmodulesEnabled;
701+
ChangesEnabled = changesEnabled;
699702
}
700703

701704
public int CommitsAhead { get; }
@@ -704,6 +707,7 @@ public UpdateCommandState(
704707
public bool PullEnabled { get; }
705708
public bool PushEnabled { get; }
706709
public bool SyncSubmodulesEnabled { get; }
710+
public bool ChangesEnabled { get; }
707711
public string PullToolTip { get; }
708712
public string PushToolTip { get; }
709713
}

src/GitHub.VisualStudio/UI/Views/PullRequestDetailView.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,16 @@
189189
VerticalAlignment="Center"/>
190190

191191
<!-- Navigate to Git changes -->
192-
<ui:GitHubActionLink Command="{Binding NavigateToGitChanges}" Content="[GitChanges]" Margin="4 0" />
192+
<ui:GitHubActionLink
193+
Command="{Binding NavigateToGitChanges}"
194+
Content="[GitChanges]" Margin="4 0"
195+
Visibility="{Binding UpdateState.ChangesEnabled, FallbackValue=Collapsed, Converter={ui:BooleanToVisibilityConverter}}" />
193196

194197
<!-- Sync submodules -->
195198
<ui:GitHubActionLink Command="{Binding SyncSubmodules}"
196199
Content="[SyncSubmodules]" Margin="4 0"
197200
Visibility="{Binding UpdateState.SyncSubmodulesEnabled, FallbackValue=Collapsed, Converter={ui:BooleanToVisibilityConverter}}" />
201+
198202
</StackPanel>
199203

200204
<!-- Branch checked out and up-to-date -->

0 commit comments

Comments
 (0)