FIX: Skip pulling hotlinked images for nil user bio (#16901)
This commit is contained in:
parent
a5779a7d0b
commit
19f583c449
|
@ -7,7 +7,7 @@ module Jobs
|
|||
raise Discourse::InvalidParameters.new(:user_id) if @user_id.blank?
|
||||
|
||||
user_profile = UserProfile.find_by(user_id: @user_id)
|
||||
return if user_profile.blank?
|
||||
return if user_profile.blank? || user_profile.bio_cooked.nil?
|
||||
|
||||
large_image_urls = []
|
||||
broken_image_urls = []
|
||||
|
|
|
@ -21,5 +21,10 @@ describe Jobs::PullUserProfileHotlinkedImages do
|
|||
expect { Jobs::PullUserProfileHotlinkedImages.new.execute(user_id: user.id) }.to change { Upload.count }.by(1)
|
||||
expect(user.user_profile.reload.bio_cooked).to include(Upload.last.url)
|
||||
end
|
||||
|
||||
it 'handles nil bio' do
|
||||
expect { Jobs::PullUserProfileHotlinkedImages.new.execute(user_id: user.id) }.to change { Upload.count }.by(0)
|
||||
expect(user.user_profile.reload.bio_cooked).to eq(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue