mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-22 01:13:39 +00:00
Added forgotten uid
This commit is contained in:
parent
fb6207f01f
commit
99e96d8923
1 changed files with 14 additions and 1 deletions
|
@ -1005,6 +1005,7 @@ function twitter_parse_link(App $a, array &$b)
|
|||
*/
|
||||
function twitter_do_mirrorpost(App $a, $uid, $post)
|
||||
{
|
||||
$datarray['uid'] = $uid;
|
||||
$datarray['extid'] = 'twitter::' . $post->id;
|
||||
$datarray['title'] = '';
|
||||
|
||||
|
@ -1065,6 +1066,14 @@ function twitter_fetchtimeline(App $a, $uid)
|
|||
|
||||
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
|
||||
|
||||
// Ensure to have the own contact
|
||||
try {
|
||||
twitter_fetch_own_contact($a, $uid);
|
||||
} catch (TwitterOAuthException $e) {
|
||||
Logger::warning('Error fetching own contact', ['uid' => $uid, 'message' => $e->getMessage()]);
|
||||
return;
|
||||
}
|
||||
|
||||
$parameters = ["exclude_replies" => true, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended", "include_ext_alt_text" => true];
|
||||
|
||||
$first_time = ($lastid == "");
|
||||
|
@ -1228,12 +1237,16 @@ function twitter_fetch_contact($uid, $data, $create_user)
|
|||
if (!empty($cid)) {
|
||||
DBA::update('contact', $fields, ['id' => $cid]);
|
||||
Contact::updateAvatar($cid, $avatar);
|
||||
} else {
|
||||
Logger::warning('No contact found', ['fields' => $fields]);
|
||||
}
|
||||
|
||||
$contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'alias' => "twitter::" . $data->id_str]);
|
||||
if (!DBA::isResult($contact) && !$create_user) {
|
||||
if (!DBA::isResult($contact) && empty($cid)) {
|
||||
Logger::warning('User contact not found', ['uid' => $uid, 'twitter-id' => $data->id_str]);
|
||||
return 0;
|
||||
} else {
|
||||
return $cid;
|
||||
}
|
||||
|
||||
if (!DBA::isResult($contact)) {
|
||||
|
|
Loading…
Reference in a new issue