diff app/models/tweet.rb @ 161:c2e9d3a36bde

Improved id check
author nanaya <me@nanaya.pro>
date Fri, 03 Aug 2018 02:01:32 +0900
parents 4e4195e60c2b
children ed73d92c7113
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