Skip to content

Commit a9ab9d3

Browse files
authored
[ENG-10405] change /myprojects to /my-projects to work good with angular (#11624)
1 parent eff0ef7 commit a9ab9d3

10 files changed

Lines changed: 25 additions & 25 deletions

File tree

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

@@ -410,7 +410,7 @@ def auth_login(auth):
410410
if campaign and logged out, go to campaign register page (with next_url if presents)
411411
if next_url and logged in, go to next url
412412
if next_url and logged out, go to cas login page with current request url as service parameter
413-
if none, go to `/myprojects` which is decorated by `@must_be_logged_in`
413+
if none, go to `/my-projects` which is decorated by `@must_be_logged_in`
414414
415415
:param auth: the auth context
416416
:return: redirects
@@ -437,7 +437,7 @@ def auth_register(auth):
437437
if next_url and logged in, go to next url
438438
if next_url and logged out, go to cas login page with current request url as service parameter
439439
if next_url and logout flag, log user out first and then go to the next_url
440-
if none, go to `/myprojects` which is decorated by `@must_be_logged_in`
440+
if none, go to `/my-projects` which is decorated by `@must_be_logged_in`
441441
442442
:param auth: the auth context
443443
:return: land, redirect or `auth_logout`
@@ -999,7 +999,7 @@ def resend_confirmation_post(auth):
999999
try:
10001000
send_confirm_email(user, clean_email, renew=True)
10011001
except KeyError:
1002-
# already confirmed, redirect to myprojects
1002+
# already confirmed, redirect to my-projects
10031003
status_message = f'This email {clean_email} has already been confirmed.'
10041004
kind = 'warning'
10051005
user.email_last_sent = timezone.now()

osf/management/commands/metrics_backfill_pageviews.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ def main(source, dry_run=False, resume_from=None):
2727
# page.info.protocol + page.info.domain => _source.platform_iri # "http://localhost:5000/",
2828
# visitor.session => _source.session_id # "fcae918a3b6a19641bd0087f84083f0d57982d8c93ab821c405561d1b5c7b305",
2929
# user.id => _source.user_is_authenticated # true,
30-
# page.url => _source.pageview_info.page_url # "http://localhost:5000/myprojects/",
30+
# page.url => _source.pageview_info.page_url # "http://localhost:5000/my-projects/",
3131
# page.title => _source.pageview_info.page_title # "OSF | My Projects",
3232
# referrer.url => _source.pageview_info.referer_url # "http://localhost:5000/csab4/analytics",
3333
# page.meta.routeName => _source.pageview_info.route_name # "OsfWebRenderer.my_projects",
3434
# time.utc.hour_of_day => _source.pageview_info.hour_of_day # 4,
35-
# page.info.path => _source.pageview_info.page_path # "/myprojects",
35+
# page.info.path => _source.pageview_info.page_path # "/my-projects",
3636
# referrer.info.domain => _source.pageview_info.referer_domain # "localhost:5000"
3737
# page.meta.public => _source.item_public # true,
3838
# node.id => _source.item_guid # "ry7dn",
@@ -85,7 +85,7 @@ def populate_action_labels(something_wonderful, row):
8585

8686
if row['page.info.path']:
8787
path_parts = row['page.info.path'].split('/')
88-
if len(path_parts) == 1 and path_parts[0] not in ('myprojects', 'goodbye', 'login'):
88+
if len(path_parts) == 1 and path_parts[0] not in ('my-projects', 'goodbye', 'login'):
8989
labels.append('view')
9090
elif path_parts[1] in ('wiki'):
9191
labels.append('view')

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 '/myprojects/' == urlparse(res.location).path
99+
assert '/my-projects/' == urlparse(res.location).path
100100
# assert len(get_session()['status']) == 1
101101

102102
def test_get_user_by_id(self):

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'] == '/myprojects/'
456+
assert res.json['redirectUrl'] == '/my-projects/'
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: 5 additions & 5 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 `/myprojects/` page which has `@must_be_logged_in` decorator
82+
# `GET /login/` without parameters is redirected to `/my-projects/` 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 'myprojects' in res.headers.get('Location')
93+
assert 'my-projects' in res.headers.get('Location')
9494

9595
def test_register_page(self):
9696
res = self.app.get('/register/')
@@ -99,14 +99,14 @@ 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 'myprojects' in res.headers.get('Location')
102+
assert 'my-projects' in res.headers.get('Location')
103103

104104
def test_sees_projects_in_her_dashboard(self):
105105
# the user already has a project
106106
project = ProjectFactory(creator=self.user)
107107
project.add_contributor(self.user)
108108
project.save()
109-
res = self.app.get('/myprojects/', auth=self.user.auth)
109+
res = self.app.get('/my-projects/', auth=self.user.auth)
110110
assert 'Projects' in res.text # Projects heading
111111

112112
def test_does_not_see_osffiles_in_user_addon_settings(self):
@@ -124,7 +124,7 @@ def test_sees_osffiles_in_project_addon_settings(self):
124124

125125
def test_sees_correct_title_on_dashboard(self):
126126
# User goes to dashboard
127-
res = self.app.get('/myprojects/', auth=self.auth, follow_redirects=True)
127+
res = self.app.get('/my-projects/', auth=self.auth, follow_redirects=True)
128128
title = res.html.title.string
129129
assert 'OSF | My Projects' == title
130130

website/routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def make_url_map(app):
309309
notemplate
310310
),
311311
Rule(
312-
'/myprojects/',
312+
'/my-projects/',
313313
'get',
314314
website_views.my_projects,
315315
OsfWebRenderer('my_projects.mako', trust=False)

website/static/js/myProjects.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ var MyProjects = {
574574
*/
575575
self.setFilterHistory = function(index) {
576576
// if not on the myprojects version of this page, don't change state (e.g., institutions)
577-
if (window.location.href.indexOf('/myprojects') === -1 ) {
577+
if (window.location.href.indexOf('/my-projects') === -1 ) {
578578
return;
579579
}
580580
var filter;
@@ -585,15 +585,15 @@ var MyProjects = {
585585
}
586586
// Uses replaceState instead of pushState because back buttons will not reset the filter on back without forcing a page refresh
587587
// A bug in history causes titles not to change despite setting them here.
588-
window.history.replaceState({setFilter: index}, 'OSF | ' + filter.title, '/myprojects/' + filter.name);
588+
window.history.replaceState({setFilter: index}, 'OSF | ' + filter.title, '/my-projects/' + filter.name);
589589
};
590590

591591
/**
592592
* Sets the initial filter based on href
593593
*/
594594
self.getFilterIndex = function() {
595595
// if not on the myprojects version of this page, don't change state (e.g., institutions)
596-
if (window.location.href.indexOf('/myprojects') === -1 ) {
596+
if (window.location.href.indexOf('/my-projects') === -1 ) {
597597
return 0;
598598
}
599599
// Cast to string undefined => "undefined" to handle upper/lower case anchors

website/templates/collection_submission_cancel.html.mako

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
% if collection_provider:
1111
<a href="${collections_link}">${collection_provider_name}</a>
1212
% else:
13-
<a href="${domain + 'myprojects/'}">${collection_provider_name}</a>
13+
<a href="${domain + 'my-projects/'}">${collection_provider_name}</a>
1414
% endif
1515
1616
was canceled. If you wish to be associated with the collection, you will need to request to be added again.
@@ -20,7 +20,7 @@
2020
% if collection_provider:
2121
<a href="${collections_link}">${collection_provider_name}</a>
2222
% else:
23-
<a href="${domain + 'myprojects/'}">${collection_provider_name}</a>
23+
<a href="${domain + 'my-projects/'}">${collection_provider_name}</a>
2424
% endif
2525
If you wish to be associated with the collection, an admin will need to request addition again.
2626
% endif

website/templates/collection_submission_removed_private.html.mako

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
% if collection_provider:
1212
<a href="${domain + 'collections/' + collection_provider__id}">${collection_provider_name}</a>
1313
% else:
14-
<a href="${domain + 'myprojects/'}">${collection_provider_name}</a>
14+
<a href="${domain + 'my-projects/'}">${collection_provider_name}</a>
1515
% endif
1616
. If you wish to be associated with the collection, you will need to request addition to the collection again.
1717
% else:
@@ -20,7 +20,7 @@
2020
% if collection_provider:
2121
<a href="${collections_link}">${collection_provider_name}</a>
2222
% else:
23-
<a href="${domain + 'myprojects/'}">${collection_provider_name}</a>
23+
<a href="${domain + 'my-projects/'}">${collection_provider_name}</a>
2424
% endif
2525
It will need to be re-submitted to be included in the collection again.
2626
% endif

website/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ def paginate(items, total, page, size):
165165

166166

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

170170

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

174174

175175
def reproducibility():

0 commit comments

Comments
 (0)