diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b36e02ccd..6d51b6a34 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -454,7 +454,7 @@ class ApplicationController < ActionController::Base def build_not_found_page(status=404, layout=false) category_topic_ids = Category.pluck(:topic_id).compact @container_class = "wrap not-found-container" - @top_viewed = Topic.where.not(id: category_topic_ids).top_viewed(10) + @top_viewed = TopicQuery.new(nil, {except_topic_ids: category_topic_ids}).list_top_for("monthly").topics.first(10) @recent = Topic.where.not(id: category_topic_ids).recent(10) @slug = params[:slug].class == String ? params[:slug] : '' @slug = (params[:id].class == String ? params[:id] : '') if @slug.blank? diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 651bf0308..20cd1de56 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1232,6 +1232,7 @@ describe UsersController do guardian = Guardian.new(user) guardian.stubs(:ensure_can_edit!).with(user).raises(Discourse::InvalidAccess.new) Guardian.stubs(new: guardian).with(user) + Guardian.stubs(new: guardian).with(nil) put :update, username: user.username, name: 'Jim Tom'