diff --git a/lib/topic_view.rb b/lib/topic_view.rb index c10c99a72fd..49c9e45b49e 100644 --- a/lib/topic_view.rb +++ b/lib/topic_view.rb @@ -349,8 +349,12 @@ class TopicView end def first_post_bookmark_reminder_at - @topic.posts.with_deleted.where(post_number: 1).first - .bookmarks.where(user: @user).pluck_first(:reminder_at) + @first_post_bookmark_reminder_at ||= \ + begin + first_post = @topic.posts.with_deleted.find_by(post_number: 1) + return if !first_post + first_post.bookmarks.where(user: @user).pluck_first(:reminder_at) + end end MAX_PARTICIPANTS = 24