From dc065eed42eb179be04f8e7cb5106089b4093a4f Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 30 Oct 2019 06:50:20 +0000 Subject: [PATCH] Fix several warnings and errors --- src/Model/GContact.php | 6 +++--- src/Model/User.php | 3 ++- src/Worker/Notifier.php | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Model/GContact.php b/src/Model/GContact.php index 2402d6b519..19d27109ea 100644 --- a/src/Model/GContact.php +++ b/src/Model/GContact.php @@ -841,7 +841,7 @@ class GContact if ($curlResult->isSuccess() && !empty($curlResult->getBody())) { $noscrape = json_decode($curlResult->getBody(), true); - if (!empty($noscrape)) { + if (!empty($noscrape) && !empty($noscrape['updated'])) { $noscrape['updated'] = DateTimeFormat::utc($noscrape['updated'], DateTimeFormat::MYSQL); $fields = ['last_contact' => DateTimeFormat::utcNow(), 'updated' => $noscrape['updated']]; DBA::update('gcontact', $fields, ['nurl' => Strings::normaliseLink($data['url'])]); @@ -1130,8 +1130,8 @@ class GContact 'birthday' => $userdata['dob'], 'photo' => $userdata['photo'], "notify" => $userdata['notify'], 'url' => $userdata['url'], "hide" => ($userdata['hidewall'] || !$userdata['net-publish']), - 'nick' => $userdata['nickname'], 'addr' => $addr, - "connect" => $addr, "server_url" => System::baseUrl(), + 'nick' => $userdata['nickname'], 'addr' => $userdata['addr'], + "connect" => $userdata['addr'], "server_url" => System::baseUrl(), "generation" => 1, 'network' => Protocol::DFRN]; self::update($gcontact); diff --git a/src/Model/User.php b/src/Model/User.php index b4da6d2568..83375115ec 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -190,7 +190,8 @@ class User `user`.`page-flags`, `user`.`account-type`, `user`.`prvnets`, - `user`.`account_removed` + `user`.`account_removed`, + `user`.`hidewall` FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid` diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index 2b802c9e3c..4562d89f34 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -152,6 +152,9 @@ class Notifier $fields = ['network', 'author-id', 'author-link', 'owner-id']; $condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]]; $thr_parent = Item::selectFirst($fields, $condition); + if (empty($thr_parent)) { + $thr_parent = $parent; + } Logger::log('GUID: ' . $target_item["guid"] . ': Parent is ' . $parent['network'] . '. Thread parent is ' . $thr_parent['network'], Logger::DEBUG); -- 2.39.5