changeset 161:c2e9d3a36bde

Improved id check
author nanaya <me@nanaya.pro>
date Fri, 03 Aug 2018 02:01:32 +0900
parents 4e4195e60c2b
children 3ff631612493
files app/models/tweet.rb
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/app/models/tweet.rb	Fri Aug 03 01:45:16 2018 +0900
+++ b/app/models/tweet.rb	Fri Aug 03 02:01:32 2018 +0900
@@ -12,7 +12,7 @@
 
   def initialize(twitter_id)
     @clients = {}
-    @twitter_id = twitter_id
+    @twitter_id = twitter_id.to_s
   end
 
   def id
@@ -52,7 +52,7 @@
           if data[:result] == :ok
             user = data[:data]
 
-            if user.id != @twitter_id || user.screen_name != @twitter_id
+            if user.id_str != @twitter_id || user.screen_name != @twitter_id
               throw "Wrong user data. Requested: #{@twitter_id}, got: #{user.id} (#{user.screen_name.printable})"
             end
           end