Use MinimalUserProfileSerializer for AccountViewSet for non-developers#23192
Merged
eviljeff merged 1 commit intomozilla:masterfrom Mar 19, 2025
Conversation
KevinMind
reviewed
Mar 19, 2025
| assert response.status_code == 404 | ||
|
|
||
| def test_is_not_full_public_profile_because_not_developer(self): | ||
| def test_is_not_full_public_profile_because_not_developer_but_fields_present(self): |
Contributor
There was a problem hiding this comment.
Nit: I would rather this be two different tests, but since we are trying to cherry-pick no need.
Member
Author
There was a problem hiding this comment.
It is two tests:
test_is_not_full_public_profile_because_not_developer_but_fields_presenttests the case with the shimtest_is_not_full_public_profile_because_not_developer_no_fieldstests without the shim is, but as it's identical to the originaltest_is_not_full_public_profile_because_not_developerit doesn't show any changed lines
Contributor
There was a problem hiding this comment.
I mean the 2 sets of assertions in the first test.
KevinMind
approved these changes
Mar 19, 2025
Contributor
KevinMind
left a comment
There was a problem hiding this comment.
URL: http://olympia.test/api/v3/accounts/account/1/
Response:
{
"id": 1,
"name": "Test",
"url": "http://olympia.test/en-US/firefox/user/1/",
"username": "local_admin",
"average_addon_rating": null,
"created": "2025-03-03T11:06:15Z",
"biography": null,
"has_anonymous_display_name": false,
"has_anonymous_username": false,
"homepage": null,
"is_addon_developer": true,
"is_artist": true,
"location": null,
"occupation": null,
"num_addons_listed": 0,
"picture_type": null,
"picture_url": null
}URL: http://olympia.test/api/v4/accounts/account/1/
{
"id": 1,
"name": "Test",
"url": "http://olympia.test/en-US/firefox/user/1/",
"username": "local_admin",
"average_addon_rating": null,
"created": "2025-03-03T11:06:15Z",
"biography": null,
"has_anonymous_display_name": false,
"has_anonymous_username": false,
"homepage": null,
"is_addon_developer": true,
"is_artist": true,
"location": null,
"occupation": null,
"num_addons_listed": 0,
"picture_type": null,
"picture_url": null
}Note
only on v5 I got an error when using an invalid sessionID cookie
URL: http://olympia.test/api/v5/accounts/account/1/
{
"id": 1,
"name": "Test",
"url": "http://olympia.test/en-US/firefox/user/1/",
"username": "local_admin",
"average_addon_rating": null,
"created": "2025-03-03T11:06:15Z",
"biography": null,
"has_anonymous_display_name": false,
"has_anonymous_username": false,
"homepage": null,
"is_addon_developer": true,
"is_artist": true,
"location": null,
"occupation": null,
"num_addons_listed": 0,
"picture_type": null,
"picture_url": null
}
Member
Author
@KevinMind sounds like something that needs further investigation (but not related to this change) |
KevinMind
pushed a commit
that referenced
this pull request
Mar 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: mozilla/addons#15479 - follow up for mozilla/addons#15402, fixing a bug in #23154
Description
See issue. We were using the wrong serializer that didn't have the API_GATE integration to shim the fields.
Context
Testing
access any
/api/v[3|4|5]/accounts/account/(int:user_id)/url without auth; see all the fields present, but with biography, etc (see original issue and pr) shim'd asnullrather than omitted.Checklist
#ISSUENUMat the top of your PR to an existing open issue in the mozilla/addons repository.