From d105bc4c605a8f9280ed5fda88128290e52ec7bc Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 7 Dec 2018 13:11:08 +0100 Subject: [PATCH] Fixed/ improved test. --- app/models/channel/driver/twitter.rb | 10 ++++++---- spec/models/channel/driver/twitter_spec.rb | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/models/channel/driver/twitter.rb b/app/models/channel/driver/twitter.rb index ac6fbf5fd..07f381fe3 100644 --- a/app/models/channel/driver/twitter.rb +++ b/app/models/channel/driver/twitter.rb @@ -177,10 +177,12 @@ returns next if !track_retweets? && tweet.retweet? # ignore older messages - if (@channel.created_at - 15.days) > tweet.created_at.dup.utc || older_import >= older_import_max - older_import += 1 - Rails.logger.debug { "tweet to old: #{tweet.id}/#{tweet.created_at}" } - next + if @sync[:import_older_tweets] != true + if (@channel.created_at - 15.days) > tweet.created_at.dup.utc || older_import >= older_import_max + older_import += 1 + Rails.logger.debug { "tweet to old: #{tweet.id}/#{tweet.created_at}" } + next + end end next if @client.locale_sender?(tweet) && own_tweet_already_imported?(tweet) diff --git a/spec/models/channel/driver/twitter_spec.rb b/spec/models/channel/driver/twitter_spec.rb index 74f418f84..c17820a4f 100644 --- a/spec/models/channel/driver/twitter_spec.rb +++ b/spec/models/channel/driver/twitter_spec.rb @@ -21,6 +21,7 @@ RSpec.describe ::Channel::Driver::Twitter do id: 'system_id', }, sync: { + import_older_tweets: true, track_retweets: true, search: [ {