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

fix(api): make UserEmailsEndpoint private #83867

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions src/sentry/apidocs/examples/user_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,3 @@ class UserExamples:
response_only=True,
)
]

LIST_USER_EMAILS = [
OpenApiExample(
"List user emails",
value=[
{
"email": "[email protected]",
"isPrimary": True,
"isVerified": True,
},
{
"email": "[email protected]",
"isPrimary": False,
"isVerified": True,
},
],
status_codes=["200"],
response_only=True,
)
]

ADD_SECONDARY_EMAIL = [
OpenApiExample(
"Adds a secondary email",
value=[
{
"email": "[email protected]",
"isPrimary": True,
"isVerified": True,
},
],
status_codes=["200", "201"],
response_only=True,
)
]
11 changes: 4 additions & 7 deletions src/sentry/users/api/endpoints/user_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
RESPONSE_FORBIDDEN,
RESPONSE_NO_CONTENT,
)
from sentry.apidocs.examples.user_examples import UserExamples
from sentry.apidocs.parameters import GlobalParams
from sentry.apidocs.utils import inline_sentry_response_serializer
from sentry.users.api.bases.user import UserEndpoint
Expand Down Expand Up @@ -98,10 +97,10 @@ def add_email(email: str, user: User) -> UserEmail:
@control_silo_endpoint
class UserEmailsEndpoint(UserEndpoint):
publish_status = {
"DELETE": ApiPublishStatus.PUBLIC,
"GET": ApiPublishStatus.PUBLIC,
"PUT": ApiPublishStatus.PUBLIC,
"POST": ApiPublishStatus.PUBLIC,
"DELETE": ApiPublishStatus.PRIVATE,
"GET": ApiPublishStatus.PRIVATE,
"PUT": ApiPublishStatus.PRIVATE,
"POST": ApiPublishStatus.PRIVATE,
}
owner = ApiOwner.UNOWNED

Expand All @@ -115,7 +114,6 @@ class UserEmailsEndpoint(UserEndpoint):
),
403: RESPONSE_FORBIDDEN,
},
examples=UserExamples.LIST_USER_EMAILS,
)
def get(self, request: Request, user: User) -> Response:
"""
Expand Down Expand Up @@ -143,7 +141,6 @@ def get(self, request: Request, user: User) -> Response:
403: RESPONSE_FORBIDDEN,
409: RESPONSE_CONFLICT,
},
examples=UserExamples.ADD_SECONDARY_EMAIL,
)
@sudo_required
def post(self, request: Request, user: User) -> Response:
Expand Down
Loading