Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into institutional-access-insti-admin-validation

* 'develop' of https://github.com/CenterForOpenScience/osf.io:
  Avoid superfluous PrivateLink query
  • Loading branch information
John Tordoff committed Jan 3, 2025
2 parents 695ed7b + 10e001b commit 344f966
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions api_tests/nodes/views/test_node_contributor_insti_admin.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import pytest
from osf.models import Contributor, NodeLog
from osf.models import Contributor
from osf_tests.factories import (
AuthUserFactory,
ProjectFactory,
InstitutionFactory,
)
from api.base.settings.defaults import API_BASE
from rest_framework import status
from tests.utils import assert_latest_log



@pytest.mark.django_db
Expand Down
5 changes: 4 additions & 1 deletion website/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,11 @@ def get_globals():
def is_private_link_anonymous_view():
# Avoid circular import
from osf.models import PrivateLink
view_only = request.args.get('view_only')
if not view_only:
return False
try:
return PrivateLink.objects.filter(key=request.args.get('view_only')).values_list('anonymous', flat=True).get()
return PrivateLink.objects.filter(key=view_only).values_list('anonymous', flat=True).get()
except PrivateLink.DoesNotExist:
return False

Expand Down

0 comments on commit 344f966

Please sign in to comment.