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

API: patch/N/checks/ shows all checks, not just checks for the patch #203

Closed
mpe opened this issue Jul 27, 2018 · 0 comments
Closed

API: patch/N/checks/ shows all checks, not just checks for the patch #203

mpe opened this issue Jul 27, 2018 · 0 comments

Comments

@mpe
Copy link
Contributor

mpe commented Jul 27, 2018

In the API you can go to a patch's detail page:

http://patchwork.ozlabs.org/api/1.0/patches/949686/

And that has a link to the checks for the patch:

http://patchwork.ozlabs.org/api/patches/949686/checks/

But the latter shows all checks ever, not just the checks for the patch.

This makes it impossible to automatically look at the checks for a given patch ID using the API.

I tried to find where the bug is but I don't know django REST framework well enough.

The URL match is:

        url(r'^patches/(?P<patch_id>[^/]+)/checks/$',
            api_check_views.CheckListCreate.as_view(),
            name='api-check-list'),

And CheckListCreate does lookup the patch and stash it in request:

        p = Patch.objects.get(id=patch_id)
        if not p.is_editable(request.user):
            raise PermissionDenied()
        request.patch = p

But from there I don't know what's supposed to use request.patch, maybe CheckFilterSet ?

stephenfin added a commit that referenced this issue Oct 14, 2018
This is either a regression or it never worked. In any case, fix it and
add a test to ensure it doesn't happen again.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: Veronika Kabatova <vkabatov@redhat.com>
Closes: #203
(cherry picked from commit e80216a)
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

No branches or pull requests

1 participant