diff --git a/app/controllers/admin/api_controller.rb b/app/controllers/admin/api_controller.rb index 57d9bce4e99..9fd25eecfbb 100644 --- a/app/controllers/admin/api_controller.rb +++ b/app/controllers/admin/api_controller.rb @@ -6,7 +6,7 @@ class Admin::ApiController < Admin::AdminController def regenerate_key api_key = ApiKey.find_by(id: params[:id]) - raise Discourse::NotFound.new if api_key.blank? + raise Discourse::NotFound if api_key.blank? api_key.regenerate!(current_user) render_serialized(api_key, ApiKeySerializer) @@ -14,7 +14,7 @@ class Admin::ApiController < Admin::AdminController def revoke_key api_key = ApiKey.find_by(id: params[:id]) - raise Discourse::NotFound.new if api_key.blank? + raise Discourse::NotFound if api_key.blank? api_key.destroy render nothing: true diff --git a/app/controllers/admin/reports_controller.rb b/app/controllers/admin/reports_controller.rb index fe6408ccd8a..cd9b7c85418 100644 --- a/app/controllers/admin/reports_controller.rb +++ b/app/controllers/admin/reports_controller.rb @@ -5,7 +5,7 @@ class Admin::ReportsController < Admin::AdminController def show report_type = params[:type] - raise Discourse::NotFound.new unless report_type =~ /^[a-z0-9\_]+$/ + raise Discourse::NotFound unless report_type =~ /^[a-z0-9\_]+$/ start_date = 1.month.ago start_date = Time.parse(params[:start_date]) if params[:start_date].present? @@ -14,7 +14,7 @@ class Admin::ReportsController < Admin::AdminController end_date = Time.parse(params[:end_date]) if params[:end_date].present? report = Report.find(report_type, {start_date: start_date, end_date: end_date}) - raise Discourse::NotFound.new if report.blank? + raise Discourse::NotFound if report.blank? render_json_dump(report: report) end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index c1194709f5d..977d1e28d74 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -38,7 +38,7 @@ class Admin::UsersController < Admin::AdminController def show @user = User.find_by(username_lower: params[:id]) - raise Discourse::NotFound.new unless @user + raise Discourse::NotFound unless @user render_serialized(@user, AdminDetailedUserSerializer, root: false) end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1c9bdbbd8ef..6775cdf5399 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -261,7 +261,7 @@ class ApplicationController < ActionController::Base elsif params[:external_id] SingleSignOnRecord.find_by(external_id: params[:external_id]).try(:user) end - raise Discourse::NotFound.new if user.blank? + raise Discourse::NotFound if user.blank? guardian.ensure_can_see!(user) user diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb index 2cc46690847..e6e30a54c14 100644 --- a/app/controllers/list_controller.rb +++ b/app/controllers/list_controller.rb @@ -225,11 +225,11 @@ class ListController < ApplicationController parent_category_id = nil if parent_slug_or_id.present? parent_category_id = Category.query_parent_category(parent_slug_or_id) - raise Discourse::NotFound.new if parent_category_id.blank? + raise Discourse::NotFound if parent_category_id.blank? end @category = Category.query_category(slug_or_id, parent_category_id) - raise Discourse::NotFound.new if !@category + raise Discourse::NotFound if !@category @description_meta = @category.description guardian.ensure_can_see!(@category) diff --git a/app/controllers/user_badges_controller.rb b/app/controllers/user_badges_controller.rb index 8ab55b2e26b..397ce503fbc 100644 --- a/app/controllers/user_badges_controller.rb +++ b/app/controllers/user_badges_controller.rb @@ -85,7 +85,7 @@ class UserBadgesController < ApplicationController else badge = Badge.find_by(name: params[:badge_name], enabled: true) end - raise Discourse::NotFound.new if badge.blank? + raise Discourse::NotFound if badge.blank? badge end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b83398ad1d4..dc168a565d5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -157,7 +157,7 @@ class UsersController < ApplicationController redirect_to path("/users/#{current_user.username}/#{params[:path]}") return end - raise Discourse::NotFound.new + raise Discourse::NotFound end def invited