Added forgotten uid

pull/1057/head
Michael 2020-12-13 16:40:50 +00:00
parent fb6207f01f
commit 99e96d8923
1 changed files with 14 additions and 1 deletions

View File

@ -1005,6 +1005,7 @@ function twitter_parse_link(App $a, array &$b)
*/ */
function twitter_do_mirrorpost(App $a, $uid, $post) function twitter_do_mirrorpost(App $a, $uid, $post)
{ {
$datarray['uid'] = $uid;
$datarray['extid'] = 'twitter::' . $post->id; $datarray['extid'] = 'twitter::' . $post->id;
$datarray['title'] = ''; $datarray['title'] = '';
@ -1065,6 +1066,14 @@ function twitter_fetchtimeline(App $a, $uid)
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); $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]; $parameters = ["exclude_replies" => true, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended", "include_ext_alt_text" => true];
$first_time = ($lastid == ""); $first_time = ($lastid == "");
@ -1228,12 +1237,16 @@ function twitter_fetch_contact($uid, $data, $create_user)
if (!empty($cid)) { if (!empty($cid)) {
DBA::update('contact', $fields, ['id' => $cid]); DBA::update('contact', $fields, ['id' => $cid]);
Contact::updateAvatar($cid, $avatar); Contact::updateAvatar($cid, $avatar);
} else {
Logger::warning('No contact found', ['fields' => $fields]);
} }
$contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'alias' => "twitter::" . $data->id_str]); $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]); Logger::warning('User contact not found', ['uid' => $uid, 'twitter-id' => $data->id_str]);
return 0; return 0;
} else {
return $cid;
} }
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {