Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Cawbird doesn't remove QT link when QTing a RT #406

Closed
IBBoard opened this issue Oct 23, 2021 · 2 comments
Closed

Cawbird doesn't remove QT link when QTing a RT #406

IBBoard opened this issue Oct 23, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@IBBoard
Copy link
Owner

IBBoard commented Oct 23, 2021

Describe the bug
If someone manually QTed a RT (i.e. copied and pasted the RT URL rather than the original RTed URL) then Cawbird shows the quoted tweet inline and the URL. With normal QTing we only show the quoted tweet inline and remove the URL.

To Reproduce
Steps to reproduce the behavior:

  1. Find a RT on twitter.com and copy the RT URL (i.e. the one with the RTers username, not the original tweet's URL)
  2. Send a tweet with it in
  3. View tweet in timeline

Expected behavior
Tweet should not include the URL (but Twitter provides the quoted tweet content and URLs/tweet IDs won't match, so it might be tricky to identify correctly)

Screenshots

https://twitter.com/IBBoard/status/1451822659889778692

Screenshot from 2021-10-23 14-25-55

System details:

  • OS: openSUSE Tumbleweed
  • Version: 1.4.2-285.1
  • Package type: IBBoard OBS
@IBBoard IBBoard added the bug Something isn't working label Oct 23, 2021
@IBBoard
Copy link
Owner Author

IBBoard commented Dec 5, 2021

JSON from QT:

{
  "created_at" : "Sun Dec 05 20:28:25 +0000 2021",
  "id" : 1467591711576793093,
  "id_str" : "1467591711576793093",
  "full_text" : "Test https://t.co/lL3yJWduZA",
  "truncated" : false,
  "display_text_range" : [
    0,
    4
  ],
  "entities" : {
    "hashtags" : [],
    "symbols" : [],
    "user_mentions" : [],
    "urls" : [
      {
        "url" : "https://t.co/lL3yJWduZA",
        "expanded_url" : "https://twitter.com/IBBoard/status/1467563570808434699",
        "display_url" : "twitter.com/IBBoard/status…",
        "indices" : [
          5,
          28
        ]
      }
    ]
  },
  "source" : "<a href=\"https://ibboard.co.uk/cawbird/#unstable\" rel=\"nofollow\">Cawbird Unstable</a>",
  "in_reply_to_status_id" : null,
  "in_reply_to_status_id_str" : null,
  "in_reply_to_user_id" : null,
  "in_reply_to_user_id_str" : null,
  "in_reply_to_screen_name" : null,
  "user" : {
    "id" : 194913600,
    "id_str" : "194913600",
    "name" : "\"Test & Account\" with a long name",
    "screen_name" : "IBBTwtr",
    "location" : "",
    "description" : "IBBoard's test account. THIS ACCOUNT WILL NEVER POST ANYTHING INTERESTING!\n\nMay be used as a spam trap. Also, Unicode and Twitter issues. \"&amp;\"",
    "url" : "https://t.co/x08aFti6xs",
    "entities" : {
      "url" : {
        "urls" : [
          {
            "url" : "https://t.co/x08aFti6xs",
            "expanded_url" : "https://ibboard.co.uk/?ibbtwtr&test",
            "display_url" : "ibboard.co.uk/?ibbtwtr&test",
            "indices" : [
              0,
              23
            ]
          }
        ]
      },
      "description" : {
        "urls" : []
      }
    },
    "protected" : false,
    "followers_count" : 3,
    "friends_count" : 11,
    "listed_count" : 0,
    "created_at" : "Sat Sep 25 09:06:35 +0000 2010",
    "favourites_count" : 1,
    "utc_offset" : null,
    "time_zone" : null,
    "geo_enabled" : false,
    "verified" : false,
    "statuses_count" : 188,
    "lang" : null,
    "contributors_enabled" : false,
    "is_translator" : false,
    "is_translation_enabled" : false,
    "profile_background_color" : "C0DEED",
    "profile_background_image_url" : "http://abs.twimg.com/images/themes/theme1/bg.png",
    "profile_background_image_url_https" : "https://abs.twimg.com/images/themes/theme1/bg.png",
    "profile_background_tile" : false,
    "profile_image_url" : "http://pbs.twimg.com/profile_images/853335069934669831/k5Y-rjee_normal.jpg",
    "profile_image_url_https" : "https://pbs.twimg.com/profile_images/853335069934669831/k5Y-rjee_normal.jpg",
    "profile_image_extensions_alt_text" : null,
    "profile_link_color" : "1DA1F2",
    "profile_sidebar_border_color" : "C0DEED",
    "profile_sidebar_fill_color" : "DDEEF6",
    "profile_text_color" : "333333",
    "profile_use_background_image" : true,
    "has_extended_profile" : false,
    "default_profile" : true,
    "default_profile_image" : false,
    "following" : true,
    "follow_request_sent" : false,
    "notifications" : false,
    "translator_type" : "none",
    "withheld_in_countries" : []
  },
  "geo" : null,
  "coordinates" : null,
  "place" : null,
  "contributors" : null,
  "is_quote_status" : true,
  "quoted_status_id" : 1467563570808434699,
  "quoted_status_id_str" : "1467563570808434699",
  "quoted_status_permalink" : {
    "url" : "https://t.co/lL3yJWduZA",
    "expanded" : "https://twitter.com/IBBoard/status/1467563570808434699",
    "display" : "twitter.com/IBBoard/status…"
  },
  "quoted_status" : {
    "created_at" : "Sun Dec 05 18:36:35 +0000 2021",
    "id" : 1467563570808434699,
    "id_str" : "1467563570808434699",
    "full_text" : "you’ve heard of superwholock now get ready for - willmelon: And it works so well because of the “Open all… Towers”! [Text is composed of parts of TV show logos and says “Open All Fools and Dad’s Porridge Towers”] https://t.co/wWKJoKFi2j",
    "truncated" : false,
    "display_text_range" : [
      0,
      236
    ],
    "entities" : {
      "hashtags" : [],
      "symbols" : [],
      "user_mentions" : [],
      "urls" : [
        {
          "url" : "https://t.co/wWKJoKFi2j",
          "expanded_url" : "https://tmblr.co/Zai-hobBSz7Zea01",
          "display_url" : "tmblr.co/Zai-hobBSz7Zea…",
          "indices" : [
            213,
            236
          ]
        }
      ]
    },
    "source" : "<a href=\"https://www.tumblr.com/\" rel=\"nofollow\">Tumblr</a>",
    "in_reply_to_status_id" : null,
    "in_reply_to_status_id_str" : null,
    "in_reply_to_user_id" : null,
    "in_reply_to_user_id_str" : null,
    "in_reply_to_screen_name" : null,
    "user" : {
      "id" : 47304773,
      "id_str" : "47304773",
      "name" : "IBBoard",
      "screen_name" : "IBBoard",
      "location" : "UK",
      "description" : "Linux user, open-source guy, geek, researcher, developer and knowledge junkie\n(Disclaimer: Comments are my own, not my work's, RT= interesting, ≠ endorsed, etc)",
      "url" : "https://t.co/H4U5tZPjJ3",
      "entities" : {
        "url" : {
          "urls" : [
            {
              "url" : "https://t.co/H4U5tZPjJ3",
              "expanded_url" : "http://ibboard.co.uk/",
              "display_url" : "ibboard.co.uk",
              "indices" : [
                0,
                23
              ]
            }
          ]
        },
        "description" : {
          "urls" : []
        }
      },
      "protected" : false,
      "followers_count" : 249,
      "friends_count" : 183,
      "listed_count" : 54,
      "created_at" : "Mon Jun 15 10:20:16 +0000 2009",
      "favourites_count" : 5042,
      "utc_offset" : null,
      "time_zone" : null,
      "geo_enabled" : false,
      "verified" : false,
      "statuses_count" : 100091,
      "lang" : null,
      "contributors_enabled" : false,
      "is_translator" : false,
      "is_translation_enabled" : false,
      "profile_background_color" : "1A1B1F",
      "profile_background_image_url" : "http://abs.twimg.com/images/themes/theme9/bg.gif",
      "profile_background_image_url_https" : "https://abs.twimg.com/images/themes/theme9/bg.gif",
      "profile_background_tile" : false,
      "profile_image_url" : "http://pbs.twimg.com/profile_images/1459549166846291974/XeVG84Z0_normal.png",
      "profile_image_url_https" : "https://pbs.twimg.com/profile_images/1459549166846291974/XeVG84Z0_normal.png",
      "profile_banner_url" : "https://pbs.twimg.com/profile_banners/47304773/1606578010",
      "profile_image_extensions_alt_text" : null,
      "profile_banner_extensions_alt_text" : null,
      "profile_link_color" : "4A704C",
      "profile_sidebar_border_color" : "181A1E",
      "profile_sidebar_fill_color" : "252429",
      "profile_text_color" : "666666",
      "profile_use_background_image" : true,
      "has_extended_profile" : false,
      "default_profile" : false,
      "default_profile_image" : false,
      "following" : false,
      "follow_request_sent" : false,
      "notifications" : false,
      "translator_type" : "none",
      "withheld_in_countries" : []
    },
    "geo" : null,
    "coordinates" : null,
    "place" : null,
    "contributors" : null,
    "is_quote_status" : false,
    "retweet_count" : 1,
    "favorite_count" : 0,
    "favorited" : false,
    "retweeted" : false,
    "possibly_sensitive" : false,
    "possibly_sensitive_appealable" : false,
    "lang" : "en"
  },
  "retweet_count" : 0,
  "favorite_count" : 0,
  "favorited" : false,
  "retweeted" : false,
  "possibly_sensitive" : false,
  "possibly_sensitive_appealable" : false,
  "lang" : "en"
}

JSON from copy and paste URL:

{
  "created_at" : "Sun Dec 05 20:29:01 +0000 2021",
  "id" : 1467591865147039749,
  "id_str" : "1467591865147039749",
  "full_text" : "Test by pasting URL\n\nhttps://t.co/hnQDTgsDV7",
  "truncated" : false,
  "display_text_range" : [
    0,
    44
  ],
  "entities" : {
    "hashtags" : [],
    "symbols" : [],
    "user_mentions" : [],
    "urls" : [
      {
        "url" : "https://t.co/hnQDTgsDV7",
        "expanded_url" : "https://twitter.com/IBBTwtr/status/1467591650994274315",
        "display_url" : "twitter.com/IBBTwtr/status…",
        "indices" : [
          21,
          44
        ]
      }
    ]
  },
  "source" : "<a href=\"https://ibboard.co.uk/cawbird/#unstable\" rel=\"nofollow\">Cawbird Unstable</a>",
  "in_reply_to_status_id" : null,
  "in_reply_to_status_id_str" : null,
  "in_reply_to_user_id" : null,
  "in_reply_to_user_id_str" : null,
  "in_reply_to_screen_name" : null,
  "user" : {
    "id" : 194913600,
    "id_str" : "194913600",
    "name" : "\"Test & Account\" with a long name",
    "screen_name" : "IBBTwtr",
    "location" : "",
    "description" : "IBBoard's test account. THIS ACCOUNT WILL NEVER POST ANYTHING INTERESTING!\n\nMay be used as a spam trap. Also, Unicode and Twitter issues. \"&amp;\"",
    "url" : "https://t.co/x08aFti6xs",
    "entities" : {
      "url" : {
        "urls" : [
          {
            "url" : "https://t.co/x08aFti6xs",
            "expanded_url" : "https://ibboard.co.uk/?ibbtwtr&test",
            "display_url" : "ibboard.co.uk/?ibbtwtr&test",
            "indices" : [
              0,
              23
            ]
          }
        ]
      },
      "description" : {
        "urls" : []
      }
    },
    "protected" : false,
    "followers_count" : 3,
    "friends_count" : 11,
    "listed_count" : 0,
    "created_at" : "Sat Sep 25 09:06:35 +0000 2010",
    "favourites_count" : 1,
    "utc_offset" : null,
    "time_zone" : null,
    "geo_enabled" : false,
    "verified" : false,
    "statuses_count" : 188,
    "lang" : null,
    "contributors_enabled" : false,
    "is_translator" : false,
    "is_translation_enabled" : false,
    "profile_background_color" : "C0DEED",
    "profile_background_image_url" : "http://abs.twimg.com/images/themes/theme1/bg.png",
    "profile_background_image_url_https" : "https://abs.twimg.com/images/themes/theme1/bg.png",
    "profile_background_tile" : false,
    "profile_image_url" : "http://pbs.twimg.com/profile_images/853335069934669831/k5Y-rjee_normal.jpg",
    "profile_image_url_https" : "https://pbs.twimg.com/profile_images/853335069934669831/k5Y-rjee_normal.jpg",
    "profile_image_extensions_alt_text" : null,
    "profile_link_color" : "1DA1F2",
    "profile_sidebar_border_color" : "C0DEED",
    "profile_sidebar_fill_color" : "DDEEF6",
    "profile_text_color" : "333333",
    "profile_use_background_image" : true,
    "has_extended_profile" : false,
    "default_profile" : true,
    "default_profile_image" : false,
    "following" : true,
    "follow_request_sent" : false,
    "notifications" : false,
    "translator_type" : "none",
    "withheld_in_countries" : []
  },
  "geo" : null,
  "coordinates" : null,
  "place" : null,
  "contributors" : null,
  "is_quote_status" : true,
  "quoted_status_id" : 1467563570808434699,
  "quoted_status_id_str" : "1467563570808434699",
  "quoted_status_permalink" : {
    "url" : "https://t.co/hnQDTgsDV7",
    "expanded" : "https://twitter.com/IBBTwtr/status/1467591650994274315",
    "display" : "twitter.com/IBBTwtr/status…"
  },
  "quoted_status" : {
    "created_at" : "Sun Dec 05 18:36:35 +0000 2021",
    "id" : 1467563570808434699,
    "id_str" : "1467563570808434699",
    "full_text" : "you’ve heard of superwholock now get ready for - willmelon: And it works so well because of the “Open all… Towers”! [Text is composed of parts of TV show logos and says “Open All Fools and Dad’s Porridge Towers”] https://t.co/wWKJoKFi2j",
    "truncated" : false,
    "display_text_range" : [
      0,
      236
    ],
    "entities" : {
      "hashtags" : [],
      "symbols" : [],
      "user_mentions" : [],
      "urls" : [
        {
          "url" : "https://t.co/wWKJoKFi2j",
          "expanded_url" : "https://tmblr.co/Zai-hobBSz7Zea01",
          "display_url" : "tmblr.co/Zai-hobBSz7Zea…",
          "indices" : [
            213,
            236
          ]
        }
      ]
    },
    "source" : "<a href=\"https://www.tumblr.com/\" rel=\"nofollow\">Tumblr</a>",
    "in_reply_to_status_id" : null,
    "in_reply_to_status_id_str" : null,
    "in_reply_to_user_id" : null,
    "in_reply_to_user_id_str" : null,
    "in_reply_to_screen_name" : null,
    "user" : {
      "id" : 47304773,
      "id_str" : "47304773",
      "name" : "IBBoard",
      "screen_name" : "IBBoard",
      "location" : "UK",
      "description" : "Linux user, open-source guy, geek, researcher, developer and knowledge junkie\n(Disclaimer: Comments are my own, not my work's, RT= interesting, ≠ endorsed, etc)",
      "url" : "https://t.co/H4U5tZPjJ3",
      "entities" : {
        "url" : {
          "urls" : [
            {
              "url" : "https://t.co/H4U5tZPjJ3",
              "expanded_url" : "http://ibboard.co.uk/",
              "display_url" : "ibboard.co.uk",
              "indices" : [
                0,
                23
              ]
            }
          ]
        },
        "description" : {
          "urls" : []
        }
      },
      "protected" : false,
      "followers_count" : 249,
      "friends_count" : 183,
      "listed_count" : 54,
      "created_at" : "Mon Jun 15 10:20:16 +0000 2009",
      "favourites_count" : 5042,
      "utc_offset" : null,
      "time_zone" : null,
      "geo_enabled" : false,
      "verified" : false,
      "statuses_count" : 100091,
      "lang" : null,
      "contributors_enabled" : false,
      "is_translator" : false,
      "is_translation_enabled" : false,
      "profile_background_color" : "1A1B1F",
      "profile_background_image_url" : "http://abs.twimg.com/images/themes/theme9/bg.gif",
      "profile_background_image_url_https" : "https://abs.twimg.com/images/themes/theme9/bg.gif",
      "profile_background_tile" : false,
      "profile_image_url" : "http://pbs.twimg.com/profile_images/1459549166846291974/XeVG84Z0_normal.png",
      "profile_image_url_https" : "https://pbs.twimg.com/profile_images/1459549166846291974/XeVG84Z0_normal.png",
      "profile_banner_url" : "https://pbs.twimg.com/profile_banners/47304773/1606578010",
      "profile_image_extensions_alt_text" : null,
      "profile_banner_extensions_alt_text" : null,
      "profile_link_color" : "4A704C",
      "profile_sidebar_border_color" : "181A1E",
      "profile_sidebar_fill_color" : "252429",
      "profile_text_color" : "666666",
      "profile_use_background_image" : true,
      "has_extended_profile" : false,
      "default_profile" : false,
      "default_profile_image" : false,
      "following" : false,
      "follow_request_sent" : false,
      "notifications" : false,
      "translator_type" : "none",
      "withheld_in_countries" : []
    },
    "geo" : null,
    "coordinates" : null,
    "place" : null,
    "contributors" : null,
    "is_quote_status" : false,
    "retweet_count" : 1,
    "favorite_count" : 0,
    "favorited" : false,
    "retweeted" : false,
    "possibly_sensitive" : false,
    "possibly_sensitive_appealable" : false,
    "lang" : "en"
  },
  "retweet_count" : 0,
  "favorite_count" : 0,
  "favorited" : false,
  "retweeted" : false,
  "possibly_sensitive" : false,
  "possibly_sensitive_appealable" : false,
  "lang" : "en"
}

The difference is that the QT JSON references the original tweet and the copy-and-paste-URL JSON references the RT. But otherwise they look the same.

--- <unnamed>
+++ <unnamed>
@@ -1,12 +1,12 @@
 {
-  "created_at" : "Sun Dec 05 20:28:25 +0000 2021",
-  "id" : 1467591711576793093,
-  "id_str" : "1467591711576793093",
-  "full_text" : "Test https://t.co/lL3yJWduZA",
+  "created_at" : "Sun Dec 05 20:29:01 +0000 2021",
+  "id" : 1467591865147039749,
+  "id_str" : "1467591865147039749",
+  "full_text" : "Test by pasting URL\n\nhttps://t.co/hnQDTgsDV7",
   "truncated" : false,
   "display_text_range" : [
     0,
-    4
+    44
   ],
   "entities" : {
     "hashtags" : [],
@@ -14,12 +14,12 @@
     "user_mentions" : [],
     "urls" : [
       {
-        "url" : "https://t.co/lL3yJWduZA",
-        "expanded_url" : "https://twitter.com/IBBoard/status/1467563570808434699",
-        "display_url" : "twitter.com/IBBoard/status…",
+        "url" : "https://t.co/hnQDTgsDV7",
+        "expanded_url" : "https://twitter.com/IBBTwtr/status/1467591650994274315",
+        "display_url" : "twitter.com/IBBTwtr/status…",
         "indices" : [
-          5,
-          28
+          21,
+          44
         ]
       }
     ]
@@ -100,9 +100,9 @@
   "quoted_status_id" : 1467563570808434699,
   "quoted_status_id_str" : "1467563570808434699",
   "quoted_status_permalink" : {
-    "url" : "https://t.co/lL3yJWduZA",
-    "expanded" : "https://twitter.com/IBBoard/status/1467563570808434699",
-    "display" : "twitter.com/IBBoard/status…"
+    "url" : "https://t.co/hnQDTgsDV7",
+    "expanded" : "https://twitter.com/IBBTwtr/status/1467591650994274315",
+    "display" : "twitter.com/IBBTwtr/status…"
   },
   "quoted_status" : {
     "created_at" : "Sun Dec 05 18:36:35 +0000 2021",

@IBBoard
Copy link
Owner Author

IBBoard commented Dec 5, 2021

Ahah! The problem is this block:

  "quoted_status_id" : 1467563570808434699,
  "quoted_status_id_str" : "1467563570808434699",
  "quoted_status_permalink" : {
    "url" : "https://t.co/hnQDTgsDV7",
    "expanded" : "https://twitter.com/IBBTwtr/status/1467591650994274315",
    "display" : "twitter.com/IBBTwtr/status…"
  },

The quoted status ID is the original ID but the quoted link URL is the RT URL. But then is_quote_link() checks the ID in the URL because we pull the quoted_status object.

@IBBoard IBBoard closed this as completed in 8c248d7 Dec 6, 2021
IBBoard added a commit that referenced this issue Feb 3, 2022
We weren't setting the magic "quote tweet URL" property!
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant