fix user lookup by email in disqus import script

This commit is contained in:
Gerhard Schlager
2017-11-16 16:26:18 +01:00
parent 678e28794a
commit 94ceb06b02
2 changed files with 7 additions and 3 deletions

View File

@ -67,7 +67,7 @@ class ImportScripts::Disqus < ImportScripts::Base
puts "Creating #{title}... (#{t[:posts].size} posts)"
topic_user = User.where('email = ? OR username = ?', t[:author_email].downcase, t[:author_username]).first
topic_user = find_existing_user(t[:author_email], t[:author_username])
begin
post = TopicEmbed.import_remote(topic_user, t[:link], title: title)
post.topic.update_column(:category_id, @category.id)
@ -77,7 +77,7 @@ class ImportScripts::Disqus < ImportScripts::Base
if post.present? && post.topic.posts_count <= 1
(t[:posts] || []).each do |p|
post_user = User.where('email = ? OR username = ?', (p[:author_email] || '').downcase, p[:author_username]).first
post_user = find_existing_user(p[:author_email] || '', p[:author_username])
next unless post_user.present?
attrs = {