Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 00a4512

Browse files
committed
Discard should always ask for confirmation
1 parent 0aa40cb commit 00a4512

File tree

4 files changed

+66
-47
lines changed

4 files changed

+66
-47
lines changed

src/GitHub.Api/Localization.Designer.cs

Lines changed: 46 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GitHub.Api/Localization.resx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,6 @@
198198
<data name="PullConfirmYes" xml:space="preserve">
199199
<value>Pull</value>
200200
</data>
201-
<data name="PullConfirmCancel" xml:space="preserve">
202-
<value>Cancel</value>
203-
</data>
204201
<data name="PushConfirmTitle" xml:space="preserve">
205202
<value>Push Changes?</value>
206203
</data>
@@ -210,9 +207,6 @@
210207
<data name="PushConfirmYes" xml:space="preserve">
211208
<value>Push</value>
212209
</data>
213-
<data name="PushConfirmCancel" xml:space="preserve">
214-
<value>Cancel</value>
215-
</data>
216210
<data name="SummaryLabel" xml:space="preserve">
217211
<value>Commit summary</value>
218212
</data>
@@ -265,7 +259,7 @@
265259
<value>ok</value>
266260
</data>
267261
<data name="Cancel" xml:space="preserve">
268-
<value>cancel</value>
262+
<value>Cancel</value>
269263
</data>
270264
<data name="PullActionTitle" xml:space="preserve">
271265
<value>Pull</value>
@@ -426,4 +420,13 @@
426420
<data name="MessageRefreshing" xml:space="preserve">
427421
<value>Refreshing</value>
428422
</data>
423+
<data name="DiscardConfirmDescription" xml:space="preserve">
424+
<value>Are you sure you want to discard these changes?</value>
425+
</data>
426+
<data name="DiscardConfirmTitle" xml:space="preserve">
427+
<value>Discard Changes?</value>
428+
</data>
429+
<data name="DiscardConfirmYes" xml:space="preserve">
430+
<value>Discard</value>
431+
</data>
429432
</root>

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ChangesView.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,14 @@ private GenericMenu CreateContextMenu(ChangesTreeNode node)
194194
discardGuiContent = new GUIContent("Discard");
195195
}
196196

197-
genericMenu.AddItem(discardGuiContent, false, () => {
197+
genericMenu.AddItem(discardGuiContent, false, () =>
198+
{
199+
if (!EditorUtility.DisplayDialog(Localization.DiscardConfirmTitle,
200+
Localization.DiscardConfirmDescription,
201+
Localization.DiscardConfirmYes,
202+
Localization.Cancel))
203+
return;
204+
198205
GitStatusEntry[] discardEntries;
199206
if (node.isFolder)
200207
{

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ private void DoActionbarGUI()
568568
EditorUtility.DisplayDialog(Localization.PullConfirmTitle,
569569
String.Format(Localization.PullConfirmDescription, currentRemoteName),
570570
Localization.PullConfirmYes,
571-
Localization.PullConfirmCancel)
571+
Localization.Cancel)
572572
)
573573
{
574574
Pull();
@@ -586,7 +586,7 @@ private void DoActionbarGUI()
586586
EditorUtility.DisplayDialog(Localization.PushConfirmTitle,
587587
String.Format(Localization.PushConfirmDescription, currentRemoteName),
588588
Localization.PushConfirmYes,
589-
Localization.PushConfirmCancel)
589+
Localization.Cancel)
590590
)
591591
{
592592
Push();

0 commit comments

Comments
 (0)