Bug 457639 - problems after attempting to discard file with compare editor changes
Summary: problems after attempting to discard file with compare editor changes
Status: NEW
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Git (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Grant Gayed CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2015-01-15 15:33 EST by Grant Gayed CLA
Modified: 2017-01-07 04:37 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Grant Gayed CLA 2015-01-15 15:33:37 EST
Steps:
- with one changed file in your workspace go to the Git page
- in the page's compare editor LHS make a change to the file but don't save it
- decide that actually you don't want to commit any changes to this file at all, so select the file's checkbox as a first step toward discarding its changes
  -> shows a "do you want to save the changes?" prompter, answer Cancel because you want to revert the file's contents, not save more changes
  -> the page allows the checkbox to become checked anyways, I'm not sure if this is a problem or not
- now push the "Checkout all the selected files" garbage can button at the top
  -> it asks again "do you want to save the changes?", again answer Cancel because it's the right response
    -> but now you've cancelled the revert, and there's no way to make it happen without a workaround, either:
        1. click back in the change editor's LHS and hold Ctrl+Z until it's back to its original text, or
        2. press the garbage can and answer "OK" to save the additional changes to the file you're trying to discard
    -> regardless of which of these workarounds was used to satisfy the page, now press the discard button and a server error is written to the console and the file changes are not discarded
Comment 1 Remy Suen CLA 2017-01-07 04:33:11 EST
Here's the stack trace when you click on the trash can for the first time.

unhookCompareWidget (gitChangeList.js:479)
preCallback (gitCommands.js:71)
preCallback (gitCommands.js:2071)
(anonymous function) (commands.js:452)

We can see that the reason we're getting a regular confirm(*) dialog instead of our custom tooltip dialog is because the compare widget is dirty. This makes sense since we never discarded the changes when the first dialog appeared...or did we?

"There are unsaved changes. Do you want to save them?"
OK / Cancel (at least, this is what I see on Electron on Windows 10)

Since this is a "do you" question, it feels to me as though it should instead be offering a Yes/No/Cancel instead of an OK/Cancel (teaching English has helped me with UX design, how about that?).

Let's look at the user's current options in the popped up dialog.

OK - Yes, I want to save my unsaved changes.
Cancel - Woah, stop this operation right now. I'm still looking at this file and I may or may not choose to edit it.

As we can see above, there is actually no option for the user to _discard_ the changes. If instead, we go with the Yes/No/Cancel options...

Yes - Yes, I want to save my unsaved changes.
No - No, I don't want to save my unsaved changes. They may be discarded.
Cancel - Woah, stop this operation right now. I'm still looking at this file and I may or may not choose to edit it.

Now the user has the option to discard the changes.

So long as the user has no option to actually ask the system to discard the changes, the user is forced to either a) save the changes or b) discard them manually via Ctrl+Z and/or looking at the diff.

-------------------

The below is what I would expect to happen.

1. The user opens the embedded compare editor in the changed file of the 'Git' page.
2. The user makes a change on the LHS of the editor.
3. The user clicks on the checkbox. A Yes/No/Cancel dialog pops up.
-Yes: The modifications are saved to disk in the working directory.
-No: The modifications are discarded and the file is not changed.
-Cancel: The modifications are preserved in the compare editor but the file in the working directory is not modified.

-------------------

Now, what I think is more interesting is _why_ the confirmation dialog is popping up in the first place. I have a dirty compare editor on the file and I'm checking a checkbox...okay, so what? I haven't asked Orion to perform any operation. I'm merely checking a checkbox. In fact, maybe I'll uncheck it back! :) What's more intrusive is that the checkbox will appear when you tick the checkbox of an _unrelated_ file! O_O

What were the designs and anticipated workflows surrounding the interaction of the embedded compare editor and the list of changes and its checkboxes?
Comment 2 Remy Suen CLA 2017-01-07 04:37:32 EST
(In reply to Grant Gayed from comment #0)
>   -> shows a "do you want to save the changes?" prompter, answer Cancel
> because you want to revert the file's contents, not save more changes

Rereading what Grant wrote here, I see that his interpretation of what the 'Cancel' button should do differs from mine.