Skip to content

Commit

Permalink
[ENG-3919] Redirect rr to registration workflow (#10051)
Browse files Browse the repository at this point in the history
* redirect rr to workflow and remove dead code.

* consolidate routes and remove superfluous function

---------

Co-authored-by: John Tordoff <>
  • Loading branch information
Johnetordoff authored Jul 25, 2023
1 parent 8c036dd commit ffcd501
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 204 deletions.
39 changes: 1 addition & 38 deletions website/registries/views.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,7 @@
# -*- coding: utf-8 -*-
from flask import request
from framework.auth import Auth, decorators
from framework.auth import decorators
from framework.utils import iso8601format
from osf.utils.permissions import ADMIN
from website.registries import utils
from website import util

def _view_registries_landing_page(campaign=None, **kwargs):
"""Landing page for the various registrations"""
auth = kwargs['auth'] = Auth.from_kwargs(request.args.to_dict(), kwargs)
is_logged_in = kwargs['auth'].logged_in
if is_logged_in:
# Using contributor_to instead of contributor_to_or_group_member.
# You need to be an admin contributor to register a node
registerable_nodes = [
node for node
in auth.user.contributor_to
if node.has_permission(user=auth.user, permission=ADMIN)
]
has_projects = bool(registerable_nodes)
else:
has_projects = False

if campaign == 'osf-registered-reports':
campaign_url_param = 'osf-registered-reports'
else:
campaign_url_param = ''

return {
'is_logged_in': is_logged_in,
'has_draft_registrations': bool(utils.drafts_for_user(auth.user, campaign)),
'has_projects': has_projects,
'campaign_long': utils.REG_CAMPAIGNS.get(campaign),
'campaign_short': campaign,
'sign_up_url': util.web_url_for('auth_register', _absolute=True, campaign=campaign_url_param, next=request.url),
}


def registered_reports_landing(**kwargs):
return _view_registries_landing_page('osf-registered-reports', **kwargs)


@decorators.must_be_logged_in
Expand Down
14 changes: 4 additions & 10 deletions website/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,13 +499,15 @@ def make_url_map(app):

Rule(
[
# Legacy routes
'/rr/',
'/registeredreports/',
'/registeredreport/',
'/prereg/',
],
'get',
registries_views.registered_reports_landing,
OsfWebRenderer('registered_reports_landing.mako', trust=False)
website_views.redirect_to_registration_workflow,
notemplate
),

Rule(
Expand All @@ -514,14 +516,6 @@ def make_url_map(app):
closed_challenges_views.erpc_landing_page,
OsfWebRenderer('erpc_landing_page.mako', trust=False)
),

Rule(
'/prereg/',
'get',
website_views.redirect_to_registration_workflow,
notemplate
),

Rule(
'/preprints/',
'get',
Expand Down
156 changes: 0 additions & 156 deletions website/templates/registered_reports_landing.mako

This file was deleted.

0 comments on commit ffcd501

Please sign in to comment.