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 throttling to contact api endpoint #1231

Closed
wants to merge 3 commits into from

Conversation

jochenklar
Copy link
Member

This PR adds throttling to the contact api endpoint.

@@ -334,6 +334,11 @@ def visibility(self, request, pk=None):
throttle_classes=[EmailThrottle])
def contact(self, request, pk):
if settings.PROJECT_CONTACT:
try:
project = self.get_object()
Copy link
Member Author

Choose a reason for hiding this comment

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

The self.get_object() (permission handling) is needed by the try ... except is not. Since I am not sold on the caching thing yet, I will fix this in the original branch.

@@ -151,7 +151,8 @@ def test_contact_get_set(db, client):

@pytest.mark.parametrize('username,password', users)
@pytest.mark.parametrize('project_id', projects)
def test_contact_post(db, client, username, password, project_id):
def test_contact_post(db, client,settings, username, password, project_id):
assert settings.PROJECT_CONTACT
Copy link
Member Author

Choose a reason for hiding this comment

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

Why do we need to check this here?

Copy link
Member

Choose a reason for hiding this comment

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

it's easier to know what this test is for like that and what the feature flag does..

Base automatically changed from interview-contact-modal to 2.3.0 January 23, 2025 14:28
@MyPyDavid
Copy link
Member

caching, with database caching as default, is not a required feature and may be an option only after the dependency on the compressor is resolved (eg. with bs5). So, it might be an option after 2.4 when there are any issues that can be resolved by caching.

@MyPyDavid MyPyDavid closed this Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants