Skip to content

Warn users when they attempt to create a PR from default branch - #1758

Merged
fregante merged 12 commits into
refined-github:masterfrom
alejandro-angulo:warn-pr-from-master
Feb 14, 2019
Merged

fregante merged 12 commits into
refined-github:masterfrom
alejandro-angulo:warn-pr-from-master

Conversation

@alejandro-angulo

@alejandro-angulo alejandro-angulo commented Feb 8, 2019 •

Copy link
Copy Markdown

Closes #1664 .

I think the commit name is pretty self-explanatory. I'm open to any suggestions on the wording of the message. Should we link to a page like this one https://blog.jasonmeridth.com/posts/do-not-issue-pull-requests-from-your-master-branch/ ? It's pretty informative, but I'm worried that this link might break eventually.

Here's a screenshot of the warning:

screenshot_2019-02-07 sindresorhus refined-github

@fregante

fregante commented Feb 8, 2019 •

Copy link
Copy Markdown
Member

You can replace everything after the first if with:

select(/* container selector */).append(
  <div class=“...”> your JSX here </div>
);

The style should be borrowed from GitHub’s own alerts, by using their classes.

The alert should be placed after the branch selector, not inside the blank state (which will be missing when there are commits).

Also maybe this should appear once the Pull Request form is open, or under the “create pull request” button.

@alejandro-angulo

alejandro-angulo commented Feb 9, 2019 •

Copy link
Copy Markdown
Author

Thanks for the feedback! Haven't touched JS in a while so I'm glad you pointed out the issues you found. I had trouble figuring out what class to use for the warning (surprise the warning class is already style by githhub).

Here's what it looks like after making the changes you mentioned:

screenshot_2019-02-08 sindresorhus refined-github

I think the warning div looks a little out of place though (could probably use some padding and a border to fit in with the rest of the page). I'm not familiar with github's styling and I'm not sure if there's a better way to style this (without introducing any extra CSS). Any idea if there are already some github styles I could leverage?

@fregante fregante left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions:

  • no uppercase, no all bold
  • much less copy; one line with a icon link is better, like #1076
  • no custom styles if possible, find a red alert on GitHub and copy its classes

@fregante

fregante commented Feb 9, 2019

Copy link
Copy Markdown
Member

Found the right style on https://github.com/<user>/<repo>/test/settings/installations

<div class="flash flash-error my-3">
    <strong>Note:</strong>
    <a href="https://developer.github.com/changes/2018-04-25-github-services-deprecation/">GitHub
    Services have been deprecated</a>. Please contact your integrator for more
    information on how to migrate or replace a service with
    <a href="https://developer.github.com/webhooks/">webhooks</a> or
    <a href="https://developer.github.com/apps/differences-between-apps/#about-github-apps/">GitHub Apps</a>.
  </div>

@fregante

Copy link
Copy Markdown
Member

screenshot 2019-02-11 at 09 55 01

@fregante

This comment has been minimized.

@fregante
fregante merged commit 4d2acf3 into refined-github:master Feb 14, 2019
@fregante

Copy link
Copy Markdown
Member

Excellent! Thanks @vacuus 🍏

@fregante fregante mentioned this pull request Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants