diff --git a/app/controllers/advertisements_controller.rb b/app/controllers/advertisements_controller.rb index f808216f1..109829d7e 100644 --- a/app/controllers/advertisements_controller.rb +++ b/app/controllers/advertisements_controller.rb @@ -48,11 +48,11 @@ class AdvertisementsController < ApplicationController redirect_to advertisements_path, :notice => "Advertisement destroyed" end - private - def advertiser_only - if !Danbooru.config.is_user_advertiser?(CurrentUser.user) - redirect_to "/static/access_denied" - return false - end +private + def advertiser_only + if !Danbooru.config.is_user_advertiser?(CurrentUser.user) + raise User::PrivilegeError + return false end + end end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 2eb7f4629..be5e57bab 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -1,7 +1,6 @@ class CommentsController < ApplicationController respond_to :html, :xml, :json before_filter :member_only, :only => [:update, :create, :edit, :destroy] - rescue_from User::PrivilegeError, :with => "static/access_denied" rescue_from ActiveRecord::StatementInvalid, :with => :search_error def index @@ -106,7 +105,6 @@ private end protected - def search_error(e) if e.message =~ /syntax error in tsquery/ @error_message = "Meta-tags are not supported in comment searches by tag" diff --git a/app/controllers/forum_posts_controller.rb b/app/controllers/forum_posts_controller.rb index bd6e05460..9008c48a6 100644 --- a/app/controllers/forum_posts_controller.rb +++ b/app/controllers/forum_posts_controller.rb @@ -1,7 +1,6 @@ class ForumPostsController < ApplicationController respond_to :html, :xml, :json, :js before_filter :member_only, :except => [:index, :show] - rescue_from User::PrivilegeError, :with => "static/access_denied" def new @forum_topic = ForumTopic.find(params[:topic_id]) if params[:topic_id] diff --git a/app/controllers/forum_topics_controller.rb b/app/controllers/forum_topics_controller.rb index 0ff5a0c4c..54ec8649b 100644 --- a/app/controllers/forum_topics_controller.rb +++ b/app/controllers/forum_topics_controller.rb @@ -3,7 +3,6 @@ class ForumTopicsController < ApplicationController before_filter :member_only, :except => [:index, :show] before_filter :normalize_search, :only => :index after_filter :update_last_forum_read_at, :only => [:show] - rescue_from User::PrivilegeError, :with => "static/access_denied" def new @forum_topic = ForumTopic.new diff --git a/app/controllers/pools_controller.rb b/app/controllers/pools_controller.rb index e424bf807..52e987e8b 100644 --- a/app/controllers/pools_controller.rb +++ b/app/controllers/pools_controller.rb @@ -2,7 +2,6 @@ class PoolsController < ApplicationController respond_to :html, :xml, :json, :js before_filter :member_only, :except => [:index, :show] before_filter :moderator_only, :only => [:destroy] - rescue_from User::PrivilegeError, :with => "static/access_denied" def new @pool = Pool.new diff --git a/app/controllers/post_appeals_controller.rb b/app/controllers/post_appeals_controller.rb index 7ed567cf3..aa90dab1c 100644 --- a/app/controllers/post_appeals_controller.rb +++ b/app/controllers/post_appeals_controller.rb @@ -1,7 +1,6 @@ class PostAppealsController < ApplicationController before_filter :member_only respond_to :html, :xml, :json, :js - rescue_from User::PrivilegeError, :with => "static/access_denied" def new @post_appeal = PostAppeal.new diff --git a/app/controllers/post_flags_controller.rb b/app/controllers/post_flags_controller.rb index 709212a12..58f358a45 100644 --- a/app/controllers/post_flags_controller.rb +++ b/app/controllers/post_flags_controller.rb @@ -1,7 +1,6 @@ class PostFlagsController < ApplicationController before_filter :member_only respond_to :html, :xml, :json, :js - rescue_from User::PrivilegeError, :with => "static/access_denied" def new @post_flag = PostFlag.new diff --git a/app/controllers/tag_subscriptions_controller.rb b/app/controllers/tag_subscriptions_controller.rb index 2eaa73e06..e213a8860 100644 --- a/app/controllers/tag_subscriptions_controller.rb +++ b/app/controllers/tag_subscriptions_controller.rb @@ -1,7 +1,6 @@ class TagSubscriptionsController < ApplicationController before_filter :member_only, :only => [:new, :edit, :create, :update, :destroy] respond_to :html, :xml, :json - rescue_from User::PrivilegeError, :with => "static/access_denied" def new @tag_subscription = TagSubscription.new diff --git a/app/controllers/user_feedbacks_controller.rb b/app/controllers/user_feedbacks_controller.rb index 4283faf7d..6a20d9a14 100644 --- a/app/controllers/user_feedbacks_controller.rb +++ b/app/controllers/user_feedbacks_controller.rb @@ -1,7 +1,6 @@ class UserFeedbacksController < ApplicationController before_filter :gold_only, :only => [:new, :edit, :create, :update, :destroy] respond_to :html, :xml, :json - rescue_from User::PrivilegeError, :with => "static/access_denied" def new @user_feedback = UserFeedback.new(params[:user_feedback])