Skip to content

Commit

Permalink
Remove deprecated /u/:username routes
Browse files Browse the repository at this point in the history
Also release `u` from TOP_LEVEL_ROUTES

Signed-off-by: Dmitriy Zaporozhets <[email protected]>
  • Loading branch information
dzaporozhets authored and Ravlen committed Jul 2, 2019
1 parent 831b35a commit 77e930c
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 45 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/pages/users/user_tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import UserOverviewBlock from './user_overview_block';
*
* <ul class="nav-links">
* <li class="activity-tab active">
* <a data-action="activity" data-target="#activity" data-toggle="tab" href="/u/username">
* <a data-action="activity" data-target="#activity" data-toggle="tab" href="/username">
* Activity
* </a>
* </li>
* <li class="groups-tab">
* <a data-action="groups" data-target="#groups" data-toggle="tab" href="/u/username/groups">
* <a data-action="groups" data-target="#groups" data-toggle="tab" href="/users/username/groups">
* Groups
* </a>
* </li>
Expand Down
5 changes: 5 additions & 0 deletions changelogs/unreleased/dz-remove-deprecated-user-routes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Remove depreated /u/:username routing
merge_request: 30044
author:
type: removed
2 changes: 1 addition & 1 deletion config/routes/snippets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
end
end

get '/s/:username', to: redirect('u/%{username}/snippets'),
get '/s/:username', to: redirect('users/%{username}/snippets'),
constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }
9 changes: 0 additions & 9 deletions config/routes/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ def override_omniauth(provider, controller, path_prefix = '/users/auth')
get :activity
get '/', to: redirect('%{username}'), as: nil
end

# Compatibility with old routing
# TODO (dzaporozhets): remove in 10.0
get '/u/:username', to: redirect('%{username}')
# TODO (dzaporozhets): remove in 9.0
get '/u/:username/groups', to: redirect('users/%{username}/groups')
get '/u/:username/projects', to: redirect('users/%{username}/projects')
get '/u/:username/snippets', to: redirect('users/%{username}/snippets')
get '/u/:username/contributed', to: redirect('users/%{username}/contributed')
end

constraints(::Constraints::UserUrlConstrainer.new) do
Expand Down
8 changes: 4 additions & 4 deletions doc/api/merge_request_approvals.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/approvals
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
"web_url": "http://localhost:3000/u/root"
"web_url": "http://localhost:3000/root"
}
}
],
Expand Down Expand Up @@ -314,7 +314,7 @@ PUT /projects/:id/merge_requests/:merge_request_iid/approvers
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
"web_url": "http://localhost:3000/u/root"
"web_url": "http://localhost:3000/root"
}
}
],
Expand Down Expand Up @@ -387,7 +387,7 @@ does not match, the response code will be `409`.
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
"web_url": "http://localhost:3000/u/root"
"web_url": "http://localhost:3000/root"
}
},
{
Expand All @@ -397,7 +397,7 @@ does not match, the response code will be `409`.
"id": 2,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/cf7ad14b34162a76d593e3affca2adca?s=80\u0026d=identicon",
"web_url": "http://localhost:3000/u/ryley"
"web_url": "http://localhost:3000/ryley"
}
}
],
Expand Down
6 changes: 3 additions & 3 deletions doc/university/process/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ title: University | Process
# Suggesting improvements

If you would like to teach a class or participate or help in any way please
submit a merge request and assign it to [Job](https://gitlab.com/u/JobV).
submit a merge request and assign it to [Job](https://gitlab.com/JobV).

If you have suggestions for additional courses you would like to see,
please submit a merge request to add an upcoming class, assign to
[Chad](https://gitlab.com/u/chadmalchow) and /cc [Job](https://gitlab.com/u/JobV).
[Chad](https://gitlab.com/chadmalchow) and /cc [Job](https://gitlab.com/JobV).

## Adding classes

Expand All @@ -31,4 +31,4 @@ please submit a merge request to add an upcoming class, assign to
1. Please upload any video recordings to our Youtube channel. We prefer them to
be public, if needed they can be unlisted but if so they should be linked from
this page.
1. Please create a merge request and assign to [Erica](https://gitlab.com/u/Erica).
1. Please create a merge request and assign to [Erica](https://gitlab.com/Erica).
1 change: 0 additions & 1 deletion lib/gitlab/path_regex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ module PathRegex
sent_notifications
slash-command-logo.png
snippets
u
unsubscribes
uploads
users
Expand Down
30 changes: 7 additions & 23 deletions spec/routing/routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'spec_helper'

# user GET /u/:username/
# user_groups GET /u/:username/groups(.:format)
# user_projects GET /u/:username/projects(.:format)
# user_contributed_projects GET /u/:username/contributed(.:format)
# user_snippets GET /u/:username/snippets(.:format)
# user_calendar GET /u/:username/calendar(.:format)
# user_calendar_activities GET /u/:username/calendar_activities(.:format)
# user GET /users/:username/
# user_groups GET /users/:username/groups(.:format)
# user_projects GET /users/:username/projects(.:format)
# user_contributed_projects GET /users/:username/contributed(.:format)
# user_snippets GET /users/:username/snippets(.:format)
# user_calendar GET /users/:username/calendar(.:format)
# user_calendar_activities GET /users/:username/calendar_activities(.:format)
describe UsersController, "routing" do
it "to #show" do
allow_any_instance_of(::Constraints::UserUrlConstrainer).to receive(:matches?).and_return(true)
Expand Down Expand Up @@ -37,22 +37,6 @@
it "to #calendar_activities" do
expect(get("/users/User/calendar_activities")).to route_to('users#calendar_activities', username: 'User')
end

describe 'redirect alias routes' do
include RSpec::Rails::RequestExampleGroup

it '/u/user1 redirects to /user1' do
expect(get("/u/user1")).to redirect_to('/user1')
end

it '/u/user1/groups redirects to /user1/groups' do
expect(get("/u/user1/groups")).to redirect_to('/users/user1/groups')
end

it '/u/user1/projects redirects to /user1/projects' do
expect(get("/u/user1/projects")).to redirect_to('/users/user1/projects')
end
end
end

# search GET /search(.:format) search#show
Expand Down
4 changes: 2 additions & 2 deletions spec/support/helpers/jira_service_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def jira_issue_comments
\"32x32\":\"http://0.0.0.0:4567/secure/useravatar?size=medium&avatarId=10122\",
\"48x48\":\"http://0.0.0.0:4567/secure/useravatar?avatarId=10122\"},
\"displayName\":\"GitLab\",\"active\":true},
\"body\":\"[Administrator|http://localhost:3000/u/root] mentioned JIRA-1 in Merge request of [gitlab-org/gitlab-test|http://localhost:3000/gitlab-org/gitlab-test/merge_requests/2].\",
\"body\":\"[Administrator|http://localhost:3000/root] mentioned JIRA-1 in Merge request of [gitlab-org/gitlab-test|http://localhost:3000/gitlab-org/gitlab-test/merge_requests/2].\",
\"updateAuthor\":{\"self\":\"http://0.0.0.0:4567/rest/api/2/user?username=gitlab\",\"name\":\"gitlab\",\"emailAddress\":\"[email protected]\",
\"avatarUrls\":{\"16x16\":\"http://0.0.0.0:4567/secure/useravatar?size=xsmall&avatarId=10122\",
\"24x24\":\"http://0.0.0.0:4567/secure/useravatar?size=small&avatarId=10122\",
Expand All @@ -40,7 +40,7 @@ def jira_issue_comments
\"24x24\":\"http://0.0.0.0:4567/secure/useravatar?size=small&avatarId=10122\",
\"32x32\":\"http://0.0.0.0:4567/secure/useravatar?size=medium&avatarId=10122\",
\"48x48\":\"http://0.0.0.0:4567/secure/useravatar?avatarId=10122\"},\"displayName\":\"GitLab\",\"active\":true},
\"body\":\"[Administrator|http://localhost:3000/u/root] mentioned this issue in [a commit of h5bp/html5-boilerplate|http://localhost:3000/h5bp/html5-boilerplate/commit/2439f77897122fbeee3bfd9bb692d3608848433e].\",
\"body\":\"[Administrator|http://localhost:3000/root] mentioned this issue in [a commit of h5bp/html5-boilerplate|http://localhost:3000/h5bp/html5-boilerplate/commit/2439f77897122fbeee3bfd9bb692d3608848433e].\",
\"updateAuthor\":{\"self\":\"http://0.0.0.0:4567/rest/api/2/user?username=gitlab\",\"name\":\"gitlab\",\"emailAddress\":\"[email protected]\",
\"avatarUrls\":{\"16x16\":\"http://0.0.0.0:4567/secure/useravatar?size=xsmall&avatarId=10122\",
\"24x24\":\"http://0.0.0.0:4567/secure/useravatar?size=small&avatarId=10122\",
Expand Down

0 comments on commit 77e930c

Please sign in to comment.