Skip to content

Commit c85d7d5

Browse files
committed
Add confirmation dialog for "Unlock all my locks" in LFS Locks
1 parent 60925a5 commit c85d7d5

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@
441441
<x:String x:Key="Text.GitLFS.Locks.Empty" xml:space="preserve">No Locked Files</x:String>
442442
<x:String x:Key="Text.GitLFS.Locks.Lock" xml:space="preserve">Lock</x:String>
443443
<x:String x:Key="Text.GitLFS.Locks.OnlyMine" xml:space="preserve">Show only my locks</x:String>
444+
<x:String x:Key="Text.GitLFS.Locks.UnlockAll.Confirm" xml:space="preserve">Are you sure you want to unlock all your locked files?</x:String>
444445
<x:String x:Key="Text.GitLFS.Locks.UnlockAllMyLocks" xml:space="preserve">Unlock all of my locks</x:String>
445446
<x:String x:Key="Text.GitLFS.Locks.Title" xml:space="preserve">LFS Locks</x:String>
446447
<x:String x:Key="Text.GitLFS.Locks.Unlock" xml:space="preserve">Unlock</x:String>

src/Views/LFSLocks.axaml.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,21 @@ private async void OnForceUnlockButtonClicked(object sender, RoutedEventArgs e)
3030
private async void OnUnlockAllMyLocksButtonClicked(object sender, RoutedEventArgs e)
3131
{
3232
if (DataContext is ViewModels.LFSLocks vm)
33-
await vm.UnlockAllMyLocksAsync(true);
33+
{
34+
Confirm dialog = new()
35+
{
36+
Message =
37+
{
38+
Text = App.Text("GitLFS.Locks.UnlockAll.Confirm")
39+
}
40+
};
41+
42+
bool result = await dialog.ShowDialog<bool>(this);
43+
if (result)
44+
{
45+
await vm.UnlockAllMyLocksAsync(true);
46+
}
47+
}
3448

3549
e.Handled = true;
3650
}

0 commit comments

Comments
 (0)