Last Comment Bug 886385 - API returns "developed":true from search and "developed":false from app endpoint
: API returns "developed":true from search and "developed":false from app endpoint
Status: RESOLVED FIXED
:
Product: Marketplace
Classification: Server Software
Component: API (show other bugs)
: 1.0
: x86_64 Windows 7
: P3 normal (vote)
: 2013-06-27
Assigned To: Rob Hudson [:robhudson]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-24 10:40 PDT by Matt Basta [:basta]
Modified: 2013-06-25 09:56 PDT (History)
3 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments

Description Matt Basta [:basta] 2013-06-24 10:40:02 PDT
As a reviewer/admin, search for an app and visit the detail page. You'll see an Edit Listing button. Then refresh the page; the button is gone.

The first view gets the app object from the search API, the second gets it from the app API.

The response should be consistent between APIs.
Comment 1 Rob Hudson [:robhudson] 2013-06-24 11:28:18 PDT
(In reply to Matt Basta [:basta] from comment #0)
> As a reviewer/admin, search for an app and visit the detail page. You'll see
> an Edit Listing button. Then refresh the page; the button is gone.
> 
> The first view gets the app object from the search API, the second gets it
> from the app API.
> 
> The response should be consistent between APIs.

Which one seems more correct?

The search uses this query:

    'developed': AddonUser.objects.filter(
                user=profile, role=amo.AUTHOR_ROLE_OWNER).exists(),

The app detail uses this query:

    'developed': app.has_author(profile, [amo.AUTHOR_ROLE_OWNER]),
Comment 2 Christopher Van Wiemeersch [:cvan] 2013-06-24 11:33:01 PDT
The former is more semantically correct. But the latter allows us to check for 'developed' instead of 'developed' or 'reviewer' or 'admin'.

I'm okay with the latter; Basta filed this bug so he probably has an opinion. (Even if he didn't file the bug, I'm sure he has an opinion ;))
Comment 3 Matt Basta [:basta] 2013-06-24 12:13:06 PDT
The former looks like it would be faster, let's go with that.
Comment 4 Rob Hudson [:robhudson] 2013-06-25 09:56:10 PDT
https://github.com/mozilla/zamboni/commit/2db983f

Note You need to log in before you can comment on or make changes to this bug.