Repository navigation
feat: suggest the license to a repository from the license page - #610
Conversation
|
Thanks @felubra! Glad to see this basically works. The project selection/autocomplete seems a little finicky to me. I think maybe because it is only searching repo name, not the user/owner. I guess it would be possible to search by name and/or owner depending on what is typed in, and combine results when searching both, but it's probably hard to get exactly right. Another way might be to not do any realtime lookup, but just take what user enters, do something with it upon hitting enter (initially only supporting full URL even), where something might be check that it is not licensed (glad you thought to filter for that, BTW) before sending on to the github.com license chooser? |
|
@mlinksva thank you for the feedback!
I think this workflow is a better option, I will do something based on this. Thank you! |
|
Following up on this, here is my implementation of your second suggestion @mlinksva. Thanks! |
| license = repositoryInfo.license | ||
| @setStatus "Error", @repositoryLicense repositoryFullName, license | ||
| else # The repository is unlicensed | ||
| window.open "https://github.com/#{repositoryFullName}/community/license/new?template=#{@licenseId}" |
There was a problem hiding this comment.
This seems to trigger both Firefox and Chrome popup blockers. Would location.href work instead?
|
This is great @felubra! If it can avoid a popup (see my review comment) I think it just needs a tiny bit of documentation, which I can suggest. |
|
@mlinksva after making the change you requested, I've noticed that the URL to suggest a license to a third-party repo is restricted to logged-in Github users. Any logged-out attempts to access it would result in a 404 error. I've prefixed it with the |
|
Hmm, 404 is definitely not a great experience. I don't think there's any way to detect if a visitor to choosealicense.com is logged into github.com, so guess the solution will have to be more up-front context, warning that one has to be logged into github.com? Maybe in the case of a valid URL for a non-licensed repo, present a click-through that explains you need to be logged in -- in place of an error if you provide a non-valid URL or a licensed repo? |
After 2d3c449 the user will never get a 404 because he will be redirected to the login page of Github, that is, after pressing enter and if the URL typed is of a valid unlicensed repository, the browser will be redirected to
Sorry if I din't understood, but checking for a invalid URL or a already licensed repository does not require a logged in user. This is done by validating the URL against a regex and fetching the public Github API, respectively. I agree with the need for more explanation. Maybe a paragraph above the input with something like:
Sounds good? |
|
No problem 😊 |
|
Great, thanks @felubra! I'm pretty happy with this now. I'm going to leave it open a few days to give others a chance to give feedback, since this is in a way a pretty big feature for choosealicense.com, though it didn't take much code or UI real estate. |
|
Just want to say thanks for taking action on this, @felubra! |
|
@kfogel I'm having a great experience and learning a lot about contributing to OSS, thank you for the providing me this opportunity 😊 |
This PR implements #401 by adding a new "Suggest this license" feature in the sidebar of the license page. The user can input a repository URL and, upon pressing enter, being redirected to a page where he can open a PR to add the license to the project.
This PR is based on the idea and valuable feedback by @mlinksva.
Edit in 2018-10-19: this explains the behavior after 4f1eab6.