Skip to content

Commit cb71c14

Browse files
[Rebase] [ENG-9177] Removed ember (CenterForOpenScience#11531)
* removed ember mentions of ember in docker and readme * removed ember-related constants, flags, tests and functionality * fixed redirects to unexisting index and dashboard flask views * fixed redirects * added redirect for removed views * removed assert for duplicated redirect as it'll be handled by angular * fix imports after notification refactor * fix tests * remove edit_draft_registration_page and new_draft_registration views --------- Co-authored-by: Ihor Sokhan <isokhan@exoft.net>
1 parent f8a01f5 commit cb71c14

9 files changed

Lines changed: 19 additions & 20 deletions

File tree

framework/auth/campaigns.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def get_campaigns():
9696
'agu_conference_2023': {
9797
'system_tag': CampaignSourceTags.AguConference2023.value,
9898
'redirect_url': furl(DOMAIN).add(path='my_projects/').url,
99-
'confirmation_email_template': NotificationTypeEnum.USER_CONFIRM_EMAIL, # added as a placeholder as removed NotificationType
99+
'confirmation_email_template': NotificationType.Type.USER_CAMPAIGN_CONFIRM_EMAIL_AGU_CONFERENCE_2023,
100100
'login_type': 'native',
101101
}
102102
})
@@ -105,7 +105,7 @@ def get_campaigns():
105105
'agu_conference': {
106106
'system_tag': CampaignSourceTags.AguConference.value,
107107
'redirect_url': furl(DOMAIN).add(path='my_projects/').url,
108-
'confirmation_email_template': NotificationTypeEnum.USER_CAMPAIGN_CONFIRM_EMAIL_AGU_CONFERENCE,
108+
'confirmation_email_template': NotificationType.Type.USER_CAMPAIGN_CONFIRM_EMAIL_AGU_CONFERENCE,
109109
'login_type': 'native',
110110
}
111111
})

framework/auth/views.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _reset_password_get(auth, uid=None, token=None, institutional=False):
8383
}
8484
raise HTTPError(http_status.HTTP_400_BAD_REQUEST, data=error_data)
8585

86-
# override routes.py login_url to redirect to my-projects
86+
# override routes.py login_url to redirect to myprojects
8787
service_url = web_url_for('my_projects', _absolute=True)
8888

8989
return {
@@ -174,7 +174,7 @@ def forgot_password_get(auth):
174174
if auth.logged_in:
175175
return auth_logout(redirect_url=request.url)
176176

177-
#overriding the routes.py sign in url to redirect to the my-projects after login
177+
#overriding the routes.py sign in url to redirect to the myprojects after login
178178
context = {}
179179
context['login_url'] = web_url_for('my_projects', _absolute=True)
180180

@@ -408,7 +408,7 @@ def auth_login(auth):
408408
if campaign and logged out, go to campaign register page (with next_url if presents)
409409
if next_url and logged in, go to next url
410410
if next_url and logged out, go to cas login page with current request url as service parameter
411-
if none, go to `/my-projects` which is decorated by `@must_be_logged_in`
411+
if none, go to `/myprojects` which is decorated by `@must_be_logged_in`
412412
413413
:param auth: the auth context
414414
:return: redirects
@@ -435,7 +435,7 @@ def auth_register(auth):
435435
if next_url and logged in, go to next url
436436
if next_url and logged out, go to cas login page with current request url as service parameter
437437
if next_url and logout flag, log user out first and then go to the next_url
438-
if none, go to `/my-projects` which is decorated by `@must_be_logged_in`
438+
if none, go to `/myprojects` which is decorated by `@must_be_logged_in`
439439
440440
:param auth: the auth context
441441
:return: land, redirect or `auth_logout`
@@ -995,7 +995,7 @@ def resend_confirmation_post(auth):
995995
try:
996996
send_confirm_email(user, clean_email, renew=True)
997997
except KeyError:
998-
# already confirmed, redirect to my-projects
998+
# already confirmed, redirect to myprojects
999999
status_message = f'This email {clean_email} has already been confirmed.'
10001000
kind = 'warning'
10011001
user.email_last_sent = timezone.now()

tests/test_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_confirm_email(self):
9696
res = self.app.resolve_redirect(res)
9797

9898
assert res.status_code == 302
99-
assert '/my-projects/' == urlparse(res.location).path
99+
assert '/myprojects/' == urlparse(res.location).path
100100
# assert len(get_session()['status']) == 1
101101

102102
def test_get_user_by_id(self):

tests/test_misc_views.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,8 @@ def test_external_login_confirm_email_get_link(self):
420420
self.user.save()
421421
assert not self.user.is_registered
422422
url = self.user.get_confirmation_url(self.user.username, external_id_provider='orcid', destination='my_projects')
423-
with capture_notifications() as notifications:
423+
with capture_notifications():
424424
res = self.app.get(url)
425-
assert len(notifications['emits']) == 1
426-
assert notifications['emits'][0]['type'] == NotificationTypeEnum.USER_EXTERNAL_LOGIN_LINK_SUCCESS
427425
assert res.status_code == 302, 'redirects to cas login'
428426
assert 'You should be redirected automatically' in str(res.html)
429427
assert '/login?service=' in res.location

tests/test_project_contributor_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def test_private_project_remove_self_not_admin(self):
453453
)
454454
self.project.reload()
455455
assert res.status_code == 200
456-
assert res.json['redirectUrl'] == '/my-projects/'
456+
assert res.json['redirectUrl'] == '/myprojects/'
457457
assert self.user2._id not in self.project.contributors
458458

459459
def test_public_project_remove_self_not_admin(self):

tests/test_webtests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_can_see_profile_url(self):
7979
res = self.app.get(self.user.url, follow_redirects=True)
8080
assert self.user.url in res.text
8181

82-
# `GET /login/` without parameters is redirected to `/my-projects/` page which has `@must_be_logged_in` decorator
82+
# `GET /login/` without parameters is redirected to `/myprojects/` page which has `@must_be_logged_in` decorator
8383
# if user is not logged in, she/he is further redirected to CAS login page
8484
def test_is_redirected_to_cas_if_not_logged_in_at_login_page(self):
8585
res = self.app.resolve_redirect(self.app.get('/login/'))
@@ -90,7 +90,7 @@ def test_is_redirected_to_cas_if_not_logged_in_at_login_page(self):
9090
def test_is_redirected_to_myprojects_if_already_logged_in_at_login_page(self):
9191
res = self.app.get('/login/', auth=self.user.auth)
9292
assert res.status_code == 302
93-
assert 'my-projects' in res.headers.get('Location')
93+
assert 'myprojects' in res.headers.get('Location')
9494

9595
def test_register_page(self):
9696
res = self.app.get('/register/')
@@ -99,7 +99,7 @@ def test_register_page(self):
9999
def test_is_redirected_to_myprojects_if_already_logged_in_at_register_page(self):
100100
res = self.app.get('/register/', auth=self.user.auth)
101101
assert res.status_code == 302
102-
assert 'my-projects' in res.headers.get('Location')
102+
assert 'myprojects' in res.headers.get('Location')
103103

104104
def test_sees_projects_in_her_dashboard(self):
105105
# the user already has a project

website/profile/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from framework.status import push_status_message
2626
from framework.utils import throttle_period_expired
2727

28-
from osf.models import ApiOAuth2Application, ApiOAuth2PersonalToken, OSFUser, NotificationTypeEnum
28+
from osf.models import ApiOAuth2Application, ApiOAuth2PersonalToken, OSFUser, NotificationType
2929
from osf.exceptions import BlockedEmailError, OSFError
3030
from osf.utils.requests import string_type_request_headers
3131
from website import mailchimp_utils

website/routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
from website.policies import views as policy_views
5151
from website.preprints import views as preprint_views
5252
from website.registries import views as registries_views
53+
from website.notifications import views as notification_views
5354
from website.closed_challenges import views as closed_challenges_views
5455
from website.identifiers import views as identifier_views
5556

website/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from addons.osfstorage.models import Region, OsfStorageFile
2121

2222
from osf import exceptions
23-
from osf.models import Guid, Preprint, AbstractNode, Node, DraftNode, Registration
23+
from osf.models import Guid, Preprint, AbstractNode, Node, DraftNode
2424

2525
from website.settings import DOMAIN
2626
from website.project.decorators import check_contributor_auth
@@ -165,11 +165,11 @@ def paginate(items, total, page, size):
165165

166166

167167
def index():
168-
return redirect('/my-projects/')
168+
return redirect('/myprojects/')
169169

170170

171171
def dashboard():
172-
return redirect('/my-projects/')
172+
return redirect('/myprojects/')
173173

174174

175175
def reproducibility():
@@ -287,7 +287,7 @@ def resolve_guid(guid, suffix=None):
287287
if clean_suffix == 'metadata':
288288
format_arg = request.args.get('format')
289289
if format_arg:
290-
return guid_metadata_download(guid, resource=resource, metadata_format=format_arg)
290+
return guid_metadata_download(guid, resource, format_arg)
291291

292292
if isinstance(resource, Preprint) and resource.provider.domain_redirect_enabled:
293293
return redirect(resource.absolute_url, http_status.HTTP_301_MOVED_PERMANENTLY)

0 commit comments

Comments
 (0)