Open domi10momo opened 3 years ago
Started GET "/?page=2&q%5Bsorts%5D=tweet_created_at+desc" for ::1 at 2021-02-28 21:34:56 +0900 Processing by TweetsController#index as HTML Parameters: {"page"=>"2", "q"=>{"sorts"=>"tweet_created_at desc"}} User Load (0.9ms) SELECT "users". FROM "users" WHERE "users"."uid" = $1 LIMIT $2 [["uid", "1333243234416398336"], ["LIMIT", 1]] ↳ app/helpers/sessions_helper.rb:11:in `current_user' Rendering tweets/index.html.erb within layouts/application Rendered tweets/_flash.html.erb (Duration: 0.1ms | Allocations: 18) (11.1ms) SELECT COUNT() FROM (SELECT DISTINCT "tweets". FROM "tweets" WHERE "tweets"."user_id" = $1 ORDER BY "tweets"."tweet_created_at" DESC) subquery_for_count [["user_id", 1]] ↳ app/views/tweets/index.html.erb:58 Tweet Load (3.4ms) SELECT DISTINCT "tweets". FROM "tweets" WHERE "tweets"."user_id" = $1 ORDER BY "tweets"."tweet_created_at" DESC LIMIT $2 OFFSET $3 [["user_id", 1], ["LIMIT", 10], ["OFFSET", 10]] ↳ app/views/tweets/index.html.erb:62 Medium Load (7.0ms) SELECT "media".* FROM "media" WHERE "media"."tweet_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) [["tweet_id", 455], ["tweet_id", 456], ["tweet_id", 457], ["tweet_id", 458], ["tweet_id", 459], ["tweet_id", 254], ["tweet_id", 255], ["tweet_id", 256], ["tweet_id", 257], ["tweet_id", 460]] ↳ app/views/tweets/index.html.erb:62 Rendered tweets/_flag_btn.html.erb (Duration: 0.1ms | Allocations: 11) Rendered tweets/_flag_btn.html.erb (Duration: 0.1ms | Allocations: 11) Rendered tweets/_flag_btn.html.erb (Duration: 0.1ms | Allocations: 11) Rendered tweets/_flag_btn.html.erb (Duration: 0.0ms | Allocations: 11) Rendered tweets/_flag_btn.html.erb (Duration: 0.1ms | Allocations: 11) Rendered tweets/_flag_btn.html.erb (Duration: 0.1ms | Allocations: 11) Rendered tweets/_flag_btn.html.erb (Duration: 0.1ms | Allocations: 11) Rendered tweets/_flag_btn.html.erb (Duration: 0.0ms | Allocations: 11) Rendered tweets/_flag_btn.html.erb (Duration: 0.1ms | Allocations: 11) Rendered tweets/_flag_btn.html.erb (Duration: 0.1ms | Allocations: 11) (7.9ms) SELECT COUNT(DISTINCT "tweets"."id") FROM "tweets" WHERE "tweets"."user_id" = $1 [["user_id", 1]] ↳ app/views/tweets/index.html.erb:97 Rendered tweets/index.html.erb within layouts/application (Duration: 91.7ms | Allocations: 13346) [Webpacker] Everything's up-to-date. Nothing to do Rendered shared/_header.html.erb (Duration: 0.2ms | Allocations: 106) Completed 200 OK in 131ms (Views: 97.8ms | ActiveRecord: 30.2ms | Allocations: 22401)
Started GET "/tweets/457" for ::1 at 2021-02-28 21:34:58 +0900
Processing by TweetsController#show as HTML
Parameters: {"id"=>"457"}
User Load (39.0ms) SELECT "users". FROM "users" WHERE "users"."uid" = $1 LIMIT $2 [["uid", "1333243234416398336"], ["LIMIT", 1]]
↳ app/helpers/sessions_helper.rb:11:in `current_user'
Tweet Load (3.5ms) SELECT "tweets". FROM "tweets" WHERE "tweets"."id" = $1 LIMIT $2 [["id", 457], ["LIMIT", 1]]
↳ app/controllers/tweets_controller.rb:23:in show' (2.6ms) SELECT COUNT(*) FROM "media" WHERE "media"."tweet_id" = $1 [["tweet_id", 457]] ↳ app/controllers/tweets_controller.rb:25:in
show'
Rendering tweets/show.html.erb within layouts/application
Rendered tweets/_flash.html.erb (Duration: 0.1ms | Allocations: 18)
Rendered tweets/_flag_btn_add_post_time.html.erb (Duration: 0.1ms | Allocations: 11)
Rendered tweets/_show_column.html.erb (Duration: 0.0ms | Allocations: 7)
Medium Load (13.9ms) SELECT "media".* FROM "media" WHERE "media"."tweet_id" = $1 [["tweet_id", 457]]
↳ app/views/tweets/show.html.erb:17
Rendered tweets/_show_column.html.erb (Duration: 0.0ms | Allocations: 9)
Rendered tweets/_show_column.html.erb (Duration: 0.0ms | Allocations: 9)
Rendered tweets/_tweet_modal.html.erb (Duration: 6.4ms | Allocations: 1494)
Rendered tweets/_retweet_modal.html.erb (Duration: 1.7ms | Allocations: 412)
Rendered tweets/show.html.erb within layouts/application (Duration: 27.1ms | Allocations: 3315)
[Webpacker] Everything's up-to-date. Nothing to do
Rendered shared/_header.html.erb (Duration: 0.2ms | Allocations: 102)
Completed 200 OK in 111ms (Views: 36.9ms | ActiveRecord: 59.1ms | Allocations: 13252)
Started POST "/tweets/repost" for ::1 at 2021-02-28 21:35:02 +0900
Processing by TweetsController#repost as HTML
Parameters: {"authenticity_token"=>"vYaJTsZtBvG/HKd5SGOD0LTcTM/6vcePe8guo8VhKhJF2y6sBsyRZHHOmYkS4abjinjKNJ9yUxMRjzvqeUf8rQ==", "tweet"=>{"text"=>"【Blog更新】 おいち…植村あかり:… https://t.co/SMwdPLyK5h #juicejuice #ジュースジュース #ハロプロ https://t.co/M4ZDXqGEsw https://t.co/asrS5QiQ3c", "media_attributes"=>{"0"=>{"id"=>"162"}, "1"=>{"id"=>"163"}, "2"=>{"id"=>"164"}}, "tweet_string_id"=>"1365668434449600517"}, "commit"=>"再投稿する"}
User Load (1.3ms) SELECT "users". FROM "users" WHERE "users"."uid" = $1 LIMIT $2 [["uid", "1333243234416398336"], ["LIMIT", 1]]
↳ app/helpers/sessions_helper.rb:11:in `current_user'
Unpermitted parameters: :text, :media_attributes
Tweet Load (34.4ms) SELECT "tweets". FROM "tweets" WHERE "tweets"."tweet_string_id" = $1 LIMIT $2 [["tweet_string_id", "1365668434449600517"], ["LIMIT", 1]]
↳ app/controllers/tweets_controller.rb:53:in repost' Medium Load (0.3ms) SELECT "media".* FROM "media" WHERE "media"."id" = $1 LIMIT $2 [["id", 162], ["LIMIT", 1]] ↳ app/lib/twitter_api.rb:20:in
block in post_tweet'
Medium Load (1.7ms) SELECT "media". FROM "media" WHERE "media"."id" = $1 LIMIT $2 [["id", 163], ["LIMIT", 1]]
↳ app/lib/twitter_api.rb:20:in `block in post_tweet'
Medium Load (0.4ms) SELECT "media". FROM "media" WHERE "media"."id" = $1 LIMIT $2 [["id", 164], ["LIMIT", 1]]
↳ app/lib/twitter_api.rb:20:in `block in post_tweet'
Traceback (most recent call last):
3: from /Users/hisadomi/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/twitter-7.0.0/lib/twitter/utils.rb:27:in block (2 levels) in pmap' 2: from /Users/hisadomi/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/twitter-7.0.0/lib/twitter/rest/tweets.rb:229:in
block in update_with_media'
1: from /Users/hisadomi/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/twitter-7.0.0/lib/twitter/rest/upload_utils.rb:13:in `upload'
/Users/hisadomi/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/twitter-7.0.0/lib/twitter/rest/upload_utils.rb:13:in `extname': no implicit conversion of StringIO into String (TypeError)
repost_error: no implicit conversion of StringIO into String
Redirected to http://localhost:3000/tweets/457
Completed 302 Found in 4421ms (ActiveRecord: 38.1ms | Allocations: 11066)
Started GET "/tweets/457" for ::1 at 2021-02-28 21:35:06 +0900
Processing by TweetsController#show as HTML
Parameters: {"id"=>"457"}
User Load (0.4ms) SELECT "users". FROM "users" WHERE "users"."uid" = $1 LIMIT $2 [["uid", "1333243234416398336"], ["LIMIT", 1]]
↳ app/helpers/sessions_helper.rb:11:in `current_user'
Tweet Load (1.1ms) SELECT "tweets". FROM "tweets" WHERE "tweets"."id" = $1 LIMIT $2 [["id", 457], ["LIMIT", 1]]
↳ app/controllers/tweets_controller.rb:23:in show' (3.2ms) SELECT COUNT(*) FROM "media" WHERE "media"."tweet_id" = $1 [["tweet_id", 457]] ↳ app/controllers/tweets_controller.rb:25:in
show'
Rendering tweets/show.html.erb within layouts/application
Rendered tweets/_flash.html.erb (Duration: 0.1ms | Allocations: 21)
Rendered tweets/_flag_btn_add_post_time.html.erb (Duration: 0.1ms | Allocations: 11)
Rendered tweets/_show_column.html.erb (Duration: 0.0ms | Allocations: 7)
Medium Load (0.3ms) SELECT "media".* FROM "media" WHERE "media"."tweet_id" = $1 [["tweet_id", 457]]
↳ app/views/tweets/show.html.erb:17
Rendered tweets/_show_column.html.erb (Duration: 0.1ms | Allocations: 9)
Rendered tweets/_show_column.html.erb (Duration: 0.1ms | Allocations: 9)
Rendered tweets/_tweet_modal.html.erb (Duration: 4.9ms | Allocations: 1494)
Rendered tweets/_retweet_modal.html.erb (Duration: 0.5ms | Allocations: 411)
Rendered tweets/show.html.erb within layouts/application (Duration: 11.4ms | Allocations: 3317)
[Webpacker] Everything's up-to-date. Nothing to do
Rendered shared/_header.html.erb (Duration: 0.3ms | Allocations: 102)
Completed 200 OK in 47ms (Views: 35.1ms | ActiveRecord: 5.0ms | Allocations: 13253)
バグの現象
本来あるべき動作
実際の動作
画像付きツイートを再投稿、RTし、そのツイートを取得し、再投稿した場合
バグの原因
ツイートを再投稿、RTし、そのツイートを取得した場合 再投稿、RT内容 + 元ツイートのURLがツイート本文の最後尾に取得される。
そのため、以下の現象が発生していると考えています。
バグの解消方法
ツイート取得の際、最後尾に元ツイートのURLがあったら削除したものをTweet.textに格納する ツイート本文の最後尾に
response["results"][ (ツイートid) ]["extended_tweet"]["extended_entities"]["media"]
内のURLと重複するものがある場合、削除したい課題 通常の投稿で、最後尾をリンク設定していた場合にどうするか