From 279c5e7b6a58be2d466fedac22cac3d3ada918eb Mon Sep 17 00:00:00 2001 From: r888888888 Date: Thu, 4 Jul 2013 20:48:06 -0700 Subject: [PATCH] fixes #1825 --- app/controllers/posts_controller.rb | 10 +++++++++- config/routes.rb | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 3a1f320fe..89291dd1a 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -1,5 +1,5 @@ class PostsController < ApplicationController - before_filter :member_only, :except => [:show, :show_seq, :index] + before_filter :member_only, :except => [:show, :show_seq, :index, :home] before_filter :builder_only, :only => [:copy_notes] after_filter :save_recent_tags, :only => [:update] respond_to :html, :xml, :json @@ -93,6 +93,14 @@ class PostsController < ApplicationController @error = x end + def home + if CurrentUser.user.is_anonymous? + redirect_to intro_explore_posts_path + else + redirect_to posts_path(:tags => params[:tags]) + end + end + private def tag_query params[:tags] || (params[:post] && params[:post][:tags]) diff --git a/config/routes.rb b/config/routes.rb index 66b5c5deb..1bc2ab7b8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -154,6 +154,9 @@ Danbooru::Application.routes.draw do resources :pool_versions, :only => [:index] resources :posts do resources :votes, :controller => "post_votes", :only => [:create, :destroy] + collection do + get :home + end member do put :revert put :copy_notes @@ -352,5 +355,5 @@ Danbooru::Application.routes.draw do match "/static/benchmark" => "static#benchmark" match "/static/name_change" => "static#name_change", :as => "name_change" - root :to => "explore/posts#intro" + root :to => "posts#home" end