At present, the twitter_pull get_items method wraps the twitter_get_items method. If the latter returns a false value, it falls back to an unauthenticated request, logging the message Twitter Pull is using an Unauthenticated request to twitter apis. Download, enable and configure the twitter module to allow for authenticated requests.
on the assumption that twitter_get_items returned false owing to the twitter module not being present/configured. However, twitter_get_items will also return false if it makes a successful request which returns no tweets. This behaviour is spurious, as it gives a false impression in the logs that there is a problem with the twitter module when invoked with arguments that results in no tweets being found.
Comment | File | Size | Author |
---|---|---|---|
#8 | twitter_pull-no_tweets_bug-2021591-6.patch | 865 bytes | scuba_fly |
#5 | twitter_pull-no_tweets_bug-2021591-5.patch | 865 bytes | pjcdawkins |
#2 | get_items_unauthenticated_request-2021591-2-D7.patch | 917 bytes | gausie |
Comments
Comment #1
pjcdawkins CreditAttribution: pjcdawkins commentedI've had this issue too
Comment #2
gausie CreditAttribution: gausie commentedThis patch fixes the issue.
It changes the output of twitter_get_items to the number of tweets received, provided an authenticated request can be made. Unavoidably, I have had to change the output of a function in the class, so this could be a breaking change for a few implementations.
Comment #3
pjcdawkins CreditAttribution: pjcdawkins commentedSetting to 'Needs review' (IMO the patch works, but I work with @gausie so somebody less biased needs to review it)
Comment #4
pstewart CreditAttribution: pstewart commentedPatch works as expected for me - zero tweet results demonstrate correct behaviour.
Comment #5
pjcdawkins CreditAttribution: pjcdawkins commentedI've re-rolled gausie's patch in #2 so that it is relative to the module's directory - no other changes.
I think this is RTBC.
Comment #6
pstewart CreditAttribution: pstewart commentedAgreed.
Comment #7
joachim CreditAttribution: joachim commentedI don't really understand what the change is here, so setting back to needs work I'm afraid.
Unrelated change.
Constants should be in caps.
I also don't really follow the change here.
That is changing the return value of this method from a boolean to an integer!
Comment #8
scuba_flyNot sure why 3. is needed from joachim's comment.
I used the patch above and now I have tweets again.
I've updated the patch to be capital letters.
left part 1 in because it is a easy codestyle fix.
Here's a new patch.
Can somebody explain part 3 from joachim's comment above? Is that really needed and why?
Hmm I somehow created the patch with comment #6.
Comment #9
scuba_flyHmm I think I see why nr3 is needed.
If the count of the tweets is 0 it will return FALSE.
Then in the method get_items() it will result in a return:
Comment #10
pjcdawkins CreditAttribution: pjcdawkins as a volunteer commentedjoachim's comment 3 suggests he hasn't read the comment in #2 - changing the return value of the function was intentional. The caller needs to know whether no value (NULL/void) is returned (because the Twitter integration isn't working or isn't configured) or just no tweets (0).