Hello, this is the last bug I will report today, I promise!

Problem:
Long tweets are clipped/shortened. Not all tweets, but definitely tweets which are on the long side (more than 130 characters)

I imagine this is done to add in the twitter link "https://t.co/..." at the end of the tweet within the twitter character limit, but surely this should be added after the full tweet?

Steps to reproduce the problem:
Install Drupal 8.3.7
Install twitter_feed 8.x-1.1 & jquery.timeago.js library
Setup the twitter API keys
Create a twitter feed block
Check the block - tweets display but long ones are shortened

Thank you for your work on this module so far, any help appreciated.

CommentFileSizeAuthor
#4 0001-Support-extended-tweets.patch1.36 KBmennega
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lauramunro created an issue. See original summary.

gambry’s picture

@lauramunro can you send an example?

I have some tweets truncated too, but this is how they come from the API, it's not the module.

On my examples tweets with 115 characters (excluding final tweet link) display correctly.
Tweets with 121 characters don't, the final tweet link is truncated, i.e. https://t.co/Fdnl5...

In between those numbers we may find the problem.

Wondering if you have the same issue?

gambry’s picture

Looks like the issue may be related to re-tweet being truncated. Check the documentation in https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/tw... .

mennega’s picture

This is due to a change in the Twitter API as part of the extended tweets rollout.

https://developer.twitter.com/en/docs/tweets/tweet-updates

Fidelix’s picture

Status: Active » Closed (works as designed)

@Gambry is right, this is how the tweet comes from the Twitter API, so it's not a bug.
But there are workarounds we can apply.

One could evaluate the (bool) truncated attribute of the tweet object.

If TRUE, an extended_tweet item in the tweet object will be available that displays the original tweet with full text.
It would be straightforward to do this directly via twig as well.

Even better - We could have an option to always display full tweets (even in RTs - which are almost truncated), but I don't think it's a good default.
Feel free to contribute a patch to add this as an option, I will apply and commit ASAP.