diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 09ca3920..b365ff09 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -83,10 +83,21 @@ class MainController < ApplicationController def set_random_content @activated_content_types.shuffle.each do |content_type| - if @universe_scope.present? - @content = content_type.constantize.where(user: current_user, universe: @universe_scope).sample + if content_type.downcase == "universe" + if @universe_scope.present? + # when we want to enable prompts for contributing universes we can remove the user: + # selector here, but we will need to verify the user has permission to see the universe + # when we do that, or else prompts could open leak + @content = content_type.constantize.where(user: current_user, id: @universe_scope.id).sample + else + @content = content_type.constantize.where(user: current_user).sample + end else - @content = content_type.constantize.where(user: current_user).sample + if @universe_scope.present? + @content = content_type.constantize.where(user: current_user, universe: @universe_scope).sample + else + @content = content_type.constantize.where(user: current_user).sample + end end return if @content.present?