comparison app/models/tweet.rb @ 163:ed73d92c7113

Whoops no id_str and wrong logic
author nanaya <me@nanaya.pro>
date Fri, 03 Aug 2018 02:12:41 +0900
parents c2e9d3a36bde
children 5af9b537db86
comparison
equal deleted inserted replaced
162:3ff631612493 163:ed73d92c7113
50 raw = Rails.cache.fetch("user:v1:#{@twitter_id}", :expires_in => self.class.cache_expires_time) do 50 raw = Rails.cache.fetch("user:v1:#{@twitter_id}", :expires_in => self.class.cache_expires_time) do
51 client_try(:user, @twitter_id).tap do |data| 51 client_try(:user, @twitter_id).tap do |data|
52 if data[:result] == :ok 52 if data[:result] == :ok
53 user = data[:data] 53 user = data[:data]
54 54
55 if user.id_str != @twitter_id || user.screen_name != @twitter_id 55 if user.id.to_s != @twitter_id && user.screen_name != @twitter_id
56 throw "Wrong user data. Requested: #{@twitter_id}, got: #{user.id} (#{user.screen_name.printable})" 56 throw "Wrong user data. Requested: #{@twitter_id}, got: #{user.id} (#{user.screen_name.printable})"
57 end 57 end
58 end 58 end
59 end 59 end
60 end 60 end