Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "How to Contribute" link and functionality #2042

Merged
merged 1 commit into from
May 10, 2018

Conversation

zakame
Copy link
Contributor

@zakame zakame commented Apr 21, 2018

This implements a link to a release's CONTRIBUTING or similar files in its MetaCPAN page:

image

Currently this will link to a new route /contributing-to/$author/$release which calls a new API implemented in metacpan/metacpan-api#802 API::Release->interesting_files and filters for Contributing/Hacking files, as implemented in metacpan/metacpan-api#803. If a Contributing file is found, it will use the appropriate renderer for it (e.g. HTML if it is in pod, source if otherwise.) If no file is found, it will show a 404 with a suggestion to contact the author.

Fixes #1779.

@oalders
Copy link
Member

oalders commented May 8, 2018

@zakame thanks for this. Could we squash this down into one commit as well?

I know we had a misunderstanding with some of this when I last reviewed it. I apologize for not communicating more clearly initially and then communicating quite rudely subsequent to that. I need to do better than that and I hope that you'll accept my apology.

My main concern is that if people are going to contribute, I don't want them to spend a lot of time going down a path that we might not be able to use, because that might discourage them from contributing again in future. That's what I was trying to express, but in a really terrible way.

if ( !exists $file->{path} ) {
my $release = join q{/}, @args;
$c->stash( {
message => 'Ask the author on how to contribute to this release.',
Copy link
Member

Choose a reason for hiding this comment

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

👍

@zakame
Copy link
Contributor Author

zakame commented May 8, 2018

@oalders no worries 😸 I certainly understand the potential additional effort if we maintain more code, and I appreciate your rigor for ensuring that every change counts for both improving the system and keeping it easy enough to hack on. 👍

@zakame zakame force-pushed the zakame/contributing-doc-api branch from c11b06d to bfdd894 Compare May 8, 2018 04:13
This adds a new model class that requests from the backend API for the
CONTRIBUTING/HACKING docs of a release, if any.

c.f. metacpan/metacpan-api@088bd9e

Add `/contribute-to/$author/$release` route

This route uses API::ContributingDoc to request for the Contributing
file, if available, and then redirects to the appropriate view (render
HTML if its pod, or leave as source if otherwise.)

Add `How to Contribute` link in release-info sidebar

This generates the appropriate `/contributing-to/` link for a
module/release, to enable
metacpan#1779.

:lipstick: `make_immutable`

Use `interesting_files` instead of a new backend API

Use metacpan/metacpan-api#803 instead of the new
`contributing_doc` call in
metacpan/metacpan-api#802 and just filter for
CONTRIBUTING/HACKING files on the controller.

:lipstick: Refactor for clarity

Use API::Release->interesting_files instead of API::ContributingDoc

The latter module seems not needed here anyway as the underlying
`/contributing_doc` endpoint is gone.  Just let the ContributingDoc
controller do its thing instead.

:lipstick: Remove obsolete API::ContributingDoc module

:lipstick: Interpolate instead of concatenate

Render *.pm variants of Contributing/Hacking as pod

Take into account
metacpan/metacpan-api@9749e00
@zakame zakame force-pushed the zakame/contributing-doc-api branch from bfdd894 to b2c27f6 Compare May 8, 2018 04:25
@zakame
Copy link
Contributor Author

zakame commented May 8, 2018

@oalders now squashed, I'll do the same for the corresponding -api PR as soon as I get feedback on metacpan/metacpan-api#803 (comment) (or sooner, if you prefer me making another PR later to improve on that.) Thanks!

@oalders
Copy link
Member

oalders commented May 8, 2018

@zakame I think you can go ahead and squash the other one. If there turns out to be an issue, we can look at dealing with it. Ideally the API would already know which files are "interesting", so possibly this is something we should be figuring out at indexing time rather than on the fly. For now, I suspect it'll be fine.

@oalders oalders merged commit 2917c4a into metacpan:master May 10, 2018
@zakame zakame deleted the zakame/contributing-doc-api branch May 10, 2018 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants