Skip to content

Commit

Permalink
change BE routing for preprints
Browse files Browse the repository at this point in the history
  • Loading branch information
adlius committed Nov 1, 2023
1 parent ac9c105 commit 8d36b2c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions website/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,16 @@ def ember_app(path=None):
for k in EXTERNAL_EMBER_APPS.keys():
if request.path.strip('/').startswith(k):
ember_app = EXTERNAL_EMBER_APPS[k]
if k == 'preprints' and request.path.rstrip('/').endswith('discover'):
# Route preprint discover pages to new search page in EOW
ember_app = EXTERNAL_EMBER_APPS.get('ember_osf_web', False) or ember_app
if k == 'preprints':
if request.path.rstrip('/').endswith('edit'):
# Route preprint edit pages to old preprint app
ember_app = EXTERNAL_EMBER_APPS.get('preprints', False) or ember_app
elif request.path.rstrip('/').endswith('submit'):
# Route preprint submit pages to old preprint app
ember_app = EXTERNAL_EMBER_APPS.get('preprints', False) or ember_app
else:
# Route other preprint pages to EOW
ember_app = EXTERNAL_EMBER_APPS.get('ember_osf_web', False) or ember_app
break

if not ember_app:
Expand Down
2 changes: 1 addition & 1 deletion website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def resolve_guid(guid, suffix=None):
if isinstance(resource, Preprint):
if resource.provider.domain_redirect_enabled:
return redirect(resource.absolute_url, http_status.HTTP_301_MOVED_PERMANENTLY)
return stream_emberapp(EXTERNAL_EMBER_APPS['preprints']['server'], preprints_dir)
return use_ember_app()

elif isinstance(resource, Registration) and (clean_suffix in ('', 'comments', 'links', 'components', 'resources',)) and waffle.flag_is_active(request, features.EMBER_REGISTRIES_DETAIL_PAGE):
return use_ember_app()
Expand Down

0 comments on commit 8d36b2c

Please sign in to comment.