Twitter: Better respect "create user" setting

This commit is contained in:
Michael 2019-09-16 04:08:50 +00:00
parent 3152513af7
commit 14c6474980

View File

@ -1036,6 +1036,7 @@ function twitter_fetch_contact($uid, $data, $create_user)
$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) && !$create_user) {
Logger::info('User contact not found', ['uid' => $uid, 'twitter-id' => $data->id_str]);
return 0; return 0;
} }
@ -1598,7 +1599,7 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection,
if (!empty($posts)) { if (!empty($posts)) {
foreach ($posts as $post) { foreach ($posts as $post) {
$postarray = twitter_createpost($a, $uid, $post, $self, false, false, false); $postarray = twitter_createpost($a, $uid, $post, $self, false, !PConfig::get($uid, 'twitter', 'create_user'), false);
if (empty($postarray['body'])) { if (empty($postarray['body'])) {
continue; continue;
@ -1780,7 +1781,7 @@ function twitter_fetchhometimeline(App $a, $uid)
twitter_fetchparentposts($a, $uid, $post, $connection, $self); twitter_fetchparentposts($a, $uid, $post, $connection, $self);
} }
$postarray = twitter_createpost($a, $uid, $post, $self, false, false, false); $postarray = twitter_createpost($a, $uid, $post, $self, false, !$create_user, false);
if (empty($postarray['body'])) { if (empty($postarray['body'])) {
continue; continue;