Fix a new bug type where blocked users' tweets can be empty-but-not-tombstoned, or something (not totally sure what this is)
This commit is contained in:
parent
631d07c6fc
commit
640ac531e5
@ -121,3 +121,8 @@ TODO: emoji-rewrite (#webserver)
|
|||||||
|
|
||||||
TODO: windows-session-list (#release, #windows)
|
TODO: windows-session-list (#release, #windows)
|
||||||
- Check that sessions load as @Offline_Twatter instead of @test\Offline_Twatter on Windows
|
- Check that sessions load as @Offline_Twatter instead of @test\Offline_Twatter on Windows
|
||||||
|
|
||||||
|
TODO: conversation-thread-missing-tweets
|
||||||
|
- In a conversation thread (replies under a tweet), if a user is blocked, the tweet response can be empty
|
||||||
|
- These are just completely invisible on Twitter (render as nothing)
|
||||||
|
- e.g.: https://x.com/sirbughunter/status/1479540319410696192
|
||||||
|
@ -463,7 +463,7 @@ func (e *APIV2Entry) ParseID() (string, TweetID) {
|
|||||||
func (e APIV2Entry) ToTweetTrove() TweetTrove {
|
func (e APIV2Entry) ToTweetTrove() TweetTrove {
|
||||||
defer func() {
|
defer func() {
|
||||||
if obj := recover(); obj != nil {
|
if obj := recover(); obj != nil {
|
||||||
log.Warnf("Panic while decoding entry: %s\n", e.OriginalJSON)
|
log.Errorf("Panic while decoding entry: %s\n", e.OriginalJSON)
|
||||||
panic(obj)
|
panic(obj)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@ -499,6 +499,8 @@ func (e APIV2Entry) ToTweetTrove() TweetTrove {
|
|||||||
if errors.Is(err, ErrorIsTombstone) {
|
if errors.Is(err, ErrorIsTombstone) {
|
||||||
// TODO: do something with tombstones in replies to a Tweet Detail
|
// TODO: do something with tombstones in replies to a Tweet Detail
|
||||||
// For now, just ignore tombstones in the replies
|
// For now, just ignore tombstones in the replies
|
||||||
|
} else if errors.Is(err, ERR_NO_TWEET) {
|
||||||
|
// TODO: handle this; some information can be recovered, we're just throwing it out
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -700,6 +700,16 @@ func TestAPIV2ConversationThreadWithTombstones(t *testing.T) {
|
|||||||
assert.Len(trove.Retweets, 0)
|
assert.Len(trove.Retweets, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAPIV2ConversationThreadEntryWithEmptyTweet(t *testing.T) {
|
||||||
|
data, err := os.ReadFile("test_responses/api_v2/conversation_thread_entry_with_empty_tweet_because_user_is_blocked.json")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
var resp APIV2Entry
|
||||||
|
err = json.Unmarshal(data, &resp)
|
||||||
|
require.NoError(t, err)
|
||||||
|
_ = resp.ToTweetTrove()
|
||||||
|
}
|
||||||
|
|
||||||
func TestTweetWithWarning(t *testing.T) {
|
func TestTweetWithWarning(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
data, err := os.ReadFile("test_responses/api_v2/tweet_with_warning.json")
|
data, err := os.ReadFile("test_responses/api_v2/tweet_with_warning.json")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user