A platform for community discussion. Free, open, simple.
FIX: return is invalid inside a block (#28036)
Joffrey JAFFEUXe954eb234ea4
diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rbindex 6b945d365f7..ec505675bc4 100644--- a/app/controllers/topics_controller.rb+++ b/app/controllers/topics_controller.rb@@ -1301,13 +1301,13 @@ class TopicsController < ApplicationControllerdef self.defer_topic_view(topic_id, ip, user_id = nil)Scheduler::Defer.later "Topic View" dotopic = Topic.find_by(id: topic_id)- return if topic.blank?+ next if topic.blank?# We need to make sure that we aren't allowing recording# random topic views against topics the user cannot see.user = User.find_by(id: user_id) if user_id.present?- return if user_id.present? && user.blank?- return if !Guardian.new(user).can_see_topic?(topic)+ next if user_id.present? && user.blank?+ next if !Guardian.new(user).can_see_topic?(topic)TopicViewItem.add(topic_id, ip, user_id)end