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:
parent
b302d7566b
commit
6d3bc3e4d0
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue