Repository navigation
first pass at UI for warning about protected branches - #7826
Conversation
|
@billygriffin @shiftkey i really like this UX approach. i'd like to lessen our reliance on popups, and i think this is a great alternate pattern. i wonder if there's a way we could explain what a protected branch is (it's probably not uncommon for someone to run into this if they don't know what a protected branch is), either with like a tooltip or making it a hyperlink to a help article? do we need to think through if there are multiple warnings above the commit message box? do they stack? (i should know this but i don't remember right now...) |
The only concern I have about this flow currently is that opening the branch list might not be enough here to get the user in a happy place:
Part of me wants to nudge the user towards the GitHub Flow here by changing the action to "Want to create a new branch?" which could open the "Create branch" popup, set to base the branch off the current branch, and then bypass the stashing flow as designed. But I guess that taps into what the goal here is - just preventing the user from committing to the wrong branch, or helping with making the GitHub flow easier, or just leaving it up to the user to put their work in the right spot?
This is probably worth exploring as part of this UI work - I lean towards leveraging our existing GitHub docs, but at the moment I have no strong feels on an approach.
This is the first proper warning message we use in the commit form area, so I wouldn't hold this PR up to address this, but it's probably worth thinking about if these would need to stack in the future and how to organize the information in a wa
I'd prefer to think of these separate to this original case, because the resulting flow may be different:
I want to keep in mind with these cases "what is the user trying to do?" as that should guide our thinking about what the app should do to help them out (if anything).
Good shout, added to my list |
|
I really like this as a happy medium! I like that we're not blocking committing, but still providing the user a way out. I'm a bit iffy on using the link style here. Seeing it in action it doesn't bother me too much, but I might expect it to open an external link. I'd be curious to see a version where we prompt the user to create a branch! Your reasoning makes a lot of sense to me @shiftkey (especially where GitHub Flow and stashing is concerned) but my only concern is I'm not sure how blocking that flow would be. If we keep this flow, I think we should skip the stashing step, since it feels inherent to this action that you'd be bringing the changes with you and the extra click feels unnecessary. As far as explaining protected branches goes, I actually don't find that necessary here. I think including an explanation in context feels a bit heavy handed - we don't tend to explain concepts in the app and instead rely on using google-able and clear language, which I think this accomplishes. "Protected branch" isn't too confusing, and if I don't know what that is it's easy to google and find our docs. |
|
Having chatted about this a bunch over the last day, I think we're trying to avoid bringing in too much change here to the flow, and instead aiming to focus on two things for the next beta:
@billygriffin @nerdneha @ampinsk is there anything else that we should have in-scope for the beta we're aiming for next week? @tierninho I'd love your feedback on this from a QA perspective if you have some time |
|
This seems great to me as our first iteration! |
|
@tierninho These are great notes, thank you!
This feels pretty important to me to ensure is working as expected.
But you can create a new branch from the branch dropdown that gets triggered when you click it, right? Your idea about admins still seeing it is a known thing and something we're hoping to be able to get more from the API about to be able to know more and provide a more guided flow only for those who can't push to the branch.
This is a great spot! I think people may work a bit different locally in keeping certain branches around to reuse and such, but I think we're all open to putting this in people's hands and then seeing if it's more natural to just guide to creating a branch. |
|
I'll follow up on the other feedback tomorrow, just wanted to add some extra context while it's fresh:
I'll see if I can reproduce this myself but I wonder if this is related to the API being refreshed (and updating local state about branch protections - such as a new branch being marked as protected). Steps to reproduce this would be grand if it's repeatable.
I didn't follow that pattern because there's already a separator between the branches list and the rest of the form (so the line felt unnecessary there). This was removed from the Merge panel in #5957 as part of reordering the elements. In the commit form there's no separator between the form and the button, which is why I believe this was included.
It'd be great to be able to prevent this from happening. I'll see if there's an event I can hook into. |
The API was triggered when we pushed but didn't seem to update the new warning message until a short time later. |
The code to update this bit of application state was hooking into when a |
5888147 to
78d1390
Compare
So this wasn't as easy as I had hoped, because of how these updates are prioritized... Updating the API information for the repository is buried deep inside
Because of that last part, where pushing a new branch will be marked as protected immediately, it felt excessive to do a full refresh of the API again after a push. Instead I refactored out the work to update branch protections into two functions, |
The context for this is outlined in #7826 (comment), but the current build should be much more snappy to update.
cc @desktop/design for feels here, but I think the current designs are fine to ship
Fixed in 5138205
I'm going to defer to @desktop/design and @desktop/product here for future iterations, but I'm not planning to make any more changes in this PR.
I'm not clear on this one - I created a branch new repository, protected the
There's a bigger headache here about visibility into protection rules that I'm talking with the teams about. We have plans to iterate here, but for the moment this doesn't block on committing for those users who know they can. We'll see what shakes out from the feedback here. |
5810f4f to
ff48b83
Compare
Co-Authored-By: Markus Olsson <[email protected]>
Co-Authored-By: Markus Olsson <[email protected]>
|
@niik thanks for the feedback!
I'll give this a try and see how it feels, but I worry I still have to track some app state as well as manage these popups. |
| const repo = await this._checkoutBranch( | ||
| repository, | ||
| branch, | ||
| uncommittedChangesStrategy |
There was a problem hiding this comment.
I want to call out this change because we had no way for AppStore.createBranch to pass its uncommittedChangesStrategy parameter to AppStore.checkoutBranch.
Without this parameter we'd always inherit the default behaviour 'AskForConfirmation', which means it would always show the "Switch Branch" dialog. But with this PR we want to bypass any other dialogs because we're assuming the user wants to take those changes with them, hence why I've added this parameter.
If there is only one branch then the text "Want to switch branches?" implies there is already two branches. This was more of an observation in case we wanted to change the wording in a future iteration to something like "Want to create a new branch?". |
I've not got feels on this change. @billygriffin what do you think? |
|
I'm happy with it for now. I'm 100% down to be more discerning in future iterations of this, which I'm very excited about. |
tierninho
left a comment
There was a problem hiding this comment.
Current build is much more snappy to update and thanks for fixing the right-click on the switch branches. Also tested branch protection using fnmatch and works 💯 I am 👍 for the first iteration.
niik
left a comment
There was a problem hiding this comment.
I'm much happier with this approach to managing state @shiftkey, thank you so much for taking the extra time to try it out.
My only remaining concern now is with how we're dealing with failed API requests. Consumers of the fetchProtectedBranches method have no way of differentiating between an API request that returned zero protected branches and one that failed meaning that if we attempt to refresh the list of protected branches while there's no internet connectivity we'll immediately clear the internal list of protected branches. Given that this is a pre-existing behavior I don't think it should hold up this PR but I feel like it warrants further investigation to determine if that's the behavior we want.









Overview
Related to #7023
Description
This PR is a quick-and-dirty implementation of the flow outlined in #7023 (comment) to gather feedback and ponder more on the warning and the initial flow.
We don't block committing currently, because some teams can be exempt from the branch protection enforcement. However we can't get a full picture of the branch protection details from the API - in particular from Enterprise Server instances - because teams can be private. I'm talking with the team responsible for this to see if there are other was for us to be able to check "can i push?" without exposing sensitive information.
Because of that limitation, I went with a mixture of the "Alternate option" and the proposed flow on this first attempt. You'll note from the GIF above that we:
TODO:
Release notes
Notes: no-notes