mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Refactor routes in order to be compatible with Rails 4
This commit is contained in:
parent
d13166fa17
commit
e39cc464b1
8 changed files with 16 additions and 16 deletions
|
@ -61,7 +61,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
rescue_from Discourse::NotLoggedIn do |e|
|
||||
raise e if Rails.env.test?
|
||||
redirect_to root_path
|
||||
redirect_to "/"
|
||||
end
|
||||
|
||||
rescue_from Discourse::NotFound do
|
||||
|
|
|
@ -24,7 +24,7 @@ class InvitesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
redirect_to root_path
|
||||
redirect_to "/"
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -44,7 +44,7 @@ class StaticController < ApplicationController
|
|||
|
||||
redirect_to(
|
||||
if params[:redirect].blank? || params[:redirect].match(login_path)
|
||||
root_path
|
||||
"/"
|
||||
else
|
||||
params[:redirect]
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<% if @needs_approval %>
|
||||
<%= t 'activation.approval_required' %>
|
||||
<% else %>
|
||||
<%= raw t('activation.please_continue', link: link_to(SiteSetting.title, root_path)) %></a>.
|
||||
<%= raw t('activation.please_continue', link: link_to(SiteSetting.title, '/')) %></a>.
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<%else%>
|
||||
<h2><%= t 'change_email.confirmed' %></h2>
|
||||
<p>
|
||||
<%= raw t('change_email.please_continue', link: link_to(SiteSetting.title, root_path)) %>
|
||||
<%= raw t('change_email.please_continue', link: link_to(SiteSetting.title, '/')) %>
|
||||
</p>
|
||||
<%end%>
|
||||
</div>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<%- if @requires_approval %>
|
||||
<%= t 'login.not_approved' %>
|
||||
<% else %>
|
||||
<%= link_to( t('password_reset.continue', site_name: SiteSetting.title), root_path ) %>
|
||||
<%= link_to( t('password_reset.continue', site_name: SiteSetting.title), '/' ) %>
|
||||
<% end %>
|
||||
</p>
|
||||
<% else %>
|
||||
|
|
|
@ -10,7 +10,7 @@ USERNAME_ROUTE_FORMAT = /[A-Za-z0-9\_]+/ unless defined? USERNAME_ROUTE_FORMAT
|
|||
|
||||
Discourse::Application.routes.draw do
|
||||
|
||||
match "/404", to: "exceptions#not_found"
|
||||
match "/404", to: "exceptions#not_found", via: [:get, :post]
|
||||
|
||||
mount Sidekiq::Web => '/sidekiq', constraints: AdminConstraint.new
|
||||
|
||||
|
@ -84,7 +84,7 @@ Discourse::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
get 'email_preferences' => 'email#preferences_redirect'
|
||||
get 'email_preferences' => 'email#preferences_redirect', :as => 'email_preferences_redirect'
|
||||
get 'email/unsubscribe/:key' => 'email#unsubscribe', as: 'email_unsubscribe'
|
||||
post 'email/resubscribe/:key' => 'email#resubscribe', as: 'email_resubscribe'
|
||||
|
||||
|
@ -148,8 +148,8 @@ Discourse::Application.routes.draw do
|
|||
resources :notifications
|
||||
resources :categories
|
||||
|
||||
match "/auth/:provider/callback", to: "users/omniauth_callbacks#complete"
|
||||
match "/auth/failure", to: "users/omniauth_callbacks#failure"
|
||||
match "/auth/:provider/callback", to: "users/omniauth_callbacks#complete", via: [:get, :post]
|
||||
match "/auth/failure", to: "users/omniauth_callbacks#failure", via: [:get, :post]
|
||||
|
||||
resources :clicks do
|
||||
collection do
|
||||
|
@ -170,8 +170,8 @@ Discourse::Application.routes.draw do
|
|||
|
||||
get 'category/:category.rss' => 'list#category_feed', format: :rss, as: 'category_feed'
|
||||
get 'category/:category' => 'list#category'
|
||||
get 'category/:category' => 'list#category', as: 'category'
|
||||
get 'category/:category/more' => 'list#category', as: 'category'
|
||||
get 'category/:category' => 'list#category'
|
||||
get 'category/:category/more' => 'list#category'
|
||||
get 'categories' => 'categories#index'
|
||||
|
||||
# We've renamed popular to latest. If people access it we want a permanent redirect.
|
||||
|
@ -241,9 +241,9 @@ Discourse::Application.routes.draw do
|
|||
get 'robots.txt' => 'robots_txt#index'
|
||||
|
||||
[:latest, :hot, :unread, :new, :favorited, :read, :posted].each do |filter|
|
||||
root to: "list##{filter}", constraints: HomePageConstraint.new("#{filter}")
|
||||
root to: "list##{filter}", constraints: HomePageConstraint.new("#{filter}"), :as => "list_#{filter}"
|
||||
end
|
||||
# special case for categories
|
||||
root to: "categories#index", constraints: HomePageConstraint.new("categories")
|
||||
root to: "categories#index", constraints: HomePageConstraint.new("categories"), :as => "categories_index"
|
||||
|
||||
end
|
||||
|
|
|
@ -48,7 +48,7 @@ describe StaticController do
|
|||
context 'without a redirect path' do
|
||||
it 'redirects to the root url' do
|
||||
xhr :post, :enter
|
||||
expect(response).to redirect_to root_path
|
||||
expect(response).to redirect_to '/'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -62,7 +62,7 @@ describe StaticController do
|
|||
context 'when the redirect path is the login page' do
|
||||
it 'redirects to the root url' do
|
||||
xhr :post, :enter, redirect: login_path
|
||||
expect(response).to redirect_to root_path
|
||||
expect(response).to redirect_to '/'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue