Mercurial > rsstweet
comparison app/models/tweet.rb @ 157:6e6051cd9cca
Or maybe not
author | nanaya <me@nanaya.pro> |
---|---|
date | Sat, 28 Jul 2018 03:42:23 +0900 |
parents | 1abfa910d83e |
children | 74422bae017d |
comparison
equal
deleted
inserted
replaced
156:1abfa910d83e | 157:6e6051cd9cca |
---|---|
24 raw = Rails.cache.fetch(cache_key, :expires_in => cache_expires_time) do | 24 raw = Rails.cache.fetch(cache_key, :expires_in => cache_expires_time) do |
25 client_try(:user_timeline, @twitter_id, TIMELINE_OPTIONS).tap do |data| | 25 client_try(:user_timeline, @twitter_id, TIMELINE_OPTIONS).tap do |data| |
26 if data[:result] == :ok | 26 if data[:result] == :ok |
27 if data[:data].any? && data[:data].first.user.id != @twitter_id | 27 if data[:data].any? && data[:data].first.user.id != @twitter_id |
28 wrong_user = data[:data].first.user | 28 wrong_user = data[:data].first.user |
29 throw "Wrong timeline data. Requested: #{@twitter_id}, got: #{wrong_user.id} (#{wrong_user.name.printable})" | 29 Rails.logger.warn "Wrong timeline data. Requested: #{@twitter_id}, got: #{wrong_user.id} (#{wrong_user.name.printable})" |
30 end | 30 end |
31 | 31 |
32 data[:data] = data[:data].select do |tweet| | 32 data[:data] = data[:data].select do |tweet| |
33 tweet.retweeted_status.nil? || tweet.user.id != tweet.retweeted_status.user.id | 33 tweet.retweeted_status.nil? || tweet.user.id != tweet.retweeted_status.user.id |
34 end.map { |tweet| tweet.to_h } | 34 end.map { |tweet| tweet.to_h } |