Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When importing a retweet, "RT @username:" is put in front of the tweet, and is added to the 140 characters. Hence, the actual tweet is being truncated.
Is there any solution for this?
Comment | File | Size | Author |
---|---|---|---|
#48 | retweet-array-not-object-1929126-48.patch | 591 bytes | ChaseOnTheWeb |
|
Comments
Comment #1
colin_vanarts CreditAttribution: colin_vanarts commentedI feel your pain..
This is resulting in multiple broken links on the new Drupal 7 website we launched last week, diminishing the usefulness of this module. I'm starting to look into fixing this bug (and if I do so, I'll try to write up a patch, but I'm new to Drupal and have not written one before).
I think the full solution is to use the image of the original tweeter, as suggested here:
https://drupal.org/node/2022717
Comment #2
colin_vanarts CreditAttribution: colin_vanarts commentedI've written a patch that fixes this issue (and 2022717) by adding a check for retweet_status on each status as the timeline is loaded.
If found to be a retweet, it is now being loaded in the constructor as a sub-tweet. When saving to the database, the user and text from the retweet are saved. The timestamp is from the retweet is not used, as this could place it in the wrong spot in the user's timeline unless further patching is done.
Comment #3
xurizaemonThanks. Patch works as advertised and stores RT in DB, but doesn't associate with the user who actually performed the RT.
I think we need to tie it back to the account which performed the RT (although I like that this preserves the original author's user pic in the Tweets view).
Have you tested what happens when multiple people RT the same Tweet? Might be only the first RT shows up, since twitter_id is a primary key.
EDIT: I guess we're going to need a second column for 'rt_screenname' or similar, and override the values when loaded or something. Need to check that a view filtered by screen_name produces the right results also.
Comment #4
leewillis77 CreditAttribution: leewillis77 commentedWe hit this problem and solved it with a modified version of the previous patch that doesn't clobber the screen name of the account that the RT was made by - it simply solves the truncation issue. Our patch attached.
Comment #5
Baysaa CreditAttribution: Baysaa commentedPatch at #4 works for me. However old tweets have still been truncated. After running cron however new tweets which get imported are fully displayed
Comment #6
DamienMcKennaTriggering the testbot.
Comment #7
DamienMcKennaTriggering the testbot.
Comment #12
AdamPS CreditAttribution: AdamPS commentedSetting parent issue - it would be great to have this one fixed in 5.9 as the truncation often chops a minimised URL contained in the tweet making the URL useless. I have rerolled the patch for the latest code.
Comment #14
AdamPS CreditAttribution: AdamPS commentedComment #15
AdamPS CreditAttribution: AdamPS commentedComment #17
AdamPS CreditAttribution: AdamPS commentedComment #18
DamienMcKennaThe patch needed a little work - please pay attention to the Drupal coding standards. I've updated the code accordingly, and reworked the trinary operator to be easier to read (i.e., got rid of it).
Comment #19
DamienMcKennaI opened a new issue for properly handling the retweet_status value: #2499505: Properly store retweet_status
Comment #20
DamienMcKennaComment #22
DamienMcKennaThis needs to be ported to the 7.x-6.x branch.
Comment #24
DamienMcKennaThe patch applied a-ok to the 6.x-5.x branch, so it has been fixed there too.
Comment #25
tobiasbHmm now the text is
RT @user: RT @user: Foobar
. Why we add this, when RT is part of the tweet text?Comment #26
DamienMcKenna@tobiasb: Oh, whoops. Lets remove the redundant RT: bit.
Comment #27
DamienMcKennaComment #30
DamienMcKennaI've uploaded the fixes for 6.x-5.x and 7.x-5.x.
Comment #31
DamienMcKennaStill need to port the change to 7.x-6.0.
Comment #32
AdamPS CreditAttribution: AdamPS commented@DamienMcKenna Thanks for you continued hard work on this module, but I think your latest changes have broken the fix.
I think the right fix now is to back out the final commit then apply another patch effectively like this. (I've not supplied a patch file as I'm not sure exactly what it would need to base against by now and hopefully it's obvious!)
Comment #33
AdamPS CreditAttribution: AdamPS commentedComment #34
DamienMcKennaLOLWhoops. X-) Thanks for double-checking my work.
Comment #35
DamienMcKennaSo like this?
Comment #36
AdamPS CreditAttribution: AdamPS commentedYes that's the essence of it. But I can't actually apply your patch to the latest dev build - this is what I used. Maybe you already backed out the other change locally which is why you have a different patch.
Comment #38
AdamPS CreditAttribution: AdamPS commentedI guess the latest dev build which I have downloaded doesn't include a check-in that's in GIT which is why we have slightly different patches. But it looks like we are all heading for the same result! Here is the whole function that I tested with.
Comment #41
DamienMcKennaOk, committed. It still needs to be ported to the 7.x-6.x branch, but the rest are a-ok.
Comment #42
DamienMcKennaUntested.
Comment #43
DamienMcKennaCommitted.
Comment #46
stropharis CreditAttribution: stropharis commentedMaybe I'm the only one, but for me imported retweets with this very module versions result in just the text "RT @: ", nothing more. User-created tweets are imported just fine, though. Could this issue be related?
Comment #47
domignon CreditAttribution: domignon commentedYou're not alone stropharis,
Same here . User-created AND tweets created by other people mentioning user imported just fine but no RT available. The database record shows an almost empty text field like if something gone wrong from line 156 of twitter.inc file
Comment #48
ChaseOnTheWebThe code is wrong, at least for 7.x-6.x, because $status->retweeted_status is an array, not an object. That might be a bug elsewhere in the module, since you would expect it to be an object just like $status. Attached is a patch to use array operators to address the immediate pain.
Comment #49
ChaseOnTheWebDoh, the same patch was posted at #2624178: Retweeted text not appears
Comment #50
domignon CreditAttribution: domignon commentedMany thanks ChaseONTheWeb