protect against bad data

This commit is contained in:
Sam 2015-09-18 11:27:56 +10:00
parent 287411525a
commit 7067d32c33

View File

@ -99,7 +99,7 @@ class TopicUser < ActiveRecord::Base
auto_track_after = User.select(:auto_track_topics_after_msecs).find_by(id: user_id).auto_track_topics_after_msecs
auto_track_after ||= SiteSetting.default_other_auto_track_topics_after_msecs
if auto_track_after >= 0 && auto_track_after <= (attrs[:total_msecs_viewed] || 0)
if auto_track_after >= 0 && auto_track_after <= (attrs[:total_msecs_viewed].to_i || 0)
attrs[:notification_level] ||= notification_levels[:tracking]
end