From e9efae4b83f57bb9c941962b6f42702c5cde46b1 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 26 May 2017 15:32:37 +0200 Subject: [PATCH] Fixed elasticsearch index issue by replace Twitter::NullObject with nil. --- ...70525000001_fixed_twitter_ticket_article_preferences.rb} | 0 lib/tweet_base.rb | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename db/migrate/{20170314000002_fixed_twitter_ticket_article_preferences.rb => 20170525000001_fixed_twitter_ticket_article_preferences.rb} (100%) diff --git a/db/migrate/20170314000002_fixed_twitter_ticket_article_preferences.rb b/db/migrate/20170525000001_fixed_twitter_ticket_article_preferences.rb similarity index 100% rename from db/migrate/20170314000002_fixed_twitter_ticket_article_preferences.rb rename to db/migrate/20170525000001_fixed_twitter_ticket_article_preferences.rb diff --git a/lib/tweet_base.rb b/lib/tweet_base.rb index 3c1388bef..52c99d15c 100644 --- a/lib/tweet_base.rb +++ b/lib/tweet_base.rb @@ -10,11 +10,11 @@ class TweetBase def user(tweet) if tweet.class == Twitter::DirectMessage - Rails.logger.error "Twitter sender for dm (#{tweet.id}): found" + Rails.logger.debug "Twitter sender for dm (#{tweet.id}): found" Rails.logger.debug tweet.sender.inspect return tweet.sender elsif tweet.class == Twitter::Tweet - Rails.logger.error "Twitter sender for tweet (#{tweet.id}): found" + Rails.logger.debug "Twitter sender for tweet (#{tweet.id}): found" Rails.logger.debug tweet.user.inspect return tweet.user else @@ -377,7 +377,7 @@ class TweetBase # replace Twitter::NullObject with nill to prevent elasticsearch index issue preferences.each { |_key, value| - next if value.class != ActiveSupport::HashWithIndifferentAccess + next if value.class != ActiveSupport::HashWithIndifferentAccess && value.class != Hash value.each { |sub_key, sub_level| next if sub_level.class != Twitter::NullObject value[sub_key] = nil