FIX: If `fancy_title` was nil the job would fail

This is because we were only selecting `fancy_title` from the DB
and the method has a fallback.
This commit is contained in:
Robin Ward 2020-01-27 12:54:50 -05:00
parent b302d7566b
commit 6d3bc3e4d0
2 changed files with 2 additions and 1 deletions

View File

@ -35,7 +35,7 @@ class PendingAssignsReminder
end
def assigned_topics(user, order:)
Topic.joins(:_custom_fields).select(:slug, :id, :fancy_title, 'topic_custom_fields.created_at AS assigned_at')
Topic.joins(:_custom_fields).select(:slug, :id, :title, :fancy_title, 'topic_custom_fields.created_at AS assigned_at')
.where('topic_custom_fields.name = ? AND topic_custom_fields.value = ?', TopicAssigner::ASSIGNED_TO_ID, user.id.to_s)
.order("topic_custom_fields.created_at #{order}")
.limit(3)

View File

@ -33,6 +33,7 @@ RSpec.describe PendingAssignsReminder do
@post1 = Fabricate(:post)
@post2 = Fabricate(:post)
@post2.topic.update_column(:fancy_title, nil)
@post3 = Fabricate(:post)
TopicAssigner.new(@post1.topic, user).assign(user)
TopicAssigner.new(@post2.topic, user).assign(user)