Merge pull request #8842 from MrPetovan/bug/warnings

Bug/warnings
This commit is contained in:
Tobias Diekershoff 2020-07-05 09:33:04 +02:00 committed by GitHub
commit 0877652bb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -367,9 +367,9 @@ function item_post(App $a) {
// get contact info for owner // get contact info for owner
if ($profile_uid == local_user() || $allow_comment) { if ($profile_uid == local_user() || $allow_comment) {
$contact_record = $author; $contact_record = $author ?: [];
} else { } else {
$contact_record = DBA::selectFirst('contact', [], ['uid' => $profile_uid, 'self' => true]); $contact_record = DBA::selectFirst('contact', [], ['uid' => $profile_uid, 'self' => true]) ?: [];
} }
// Look for any tags and linkify them // Look for any tags and linkify them
@ -423,7 +423,7 @@ function item_post(App $a) {
$original_contact_id = $contact_id; $original_contact_id = $contact_id;
if (!$toplevel_item_id && count($forum_contact) && ($private_forum || $only_to_forum)) { if (!$toplevel_item_id && !empty($forum_contact) && ($private_forum || $only_to_forum)) {
// we tagged a forum in a top level post. Now we change the post // we tagged a forum in a top level post. Now we change the post
$private = $private_forum; $private = $private_forum;
@ -564,9 +564,9 @@ function item_post(App $a) {
$datarray['gravity'] = $gravity; $datarray['gravity'] = $gravity;
$datarray['network'] = $network; $datarray['network'] = $network;
$datarray['contact-id'] = $contact_id; $datarray['contact-id'] = $contact_id;
$datarray['owner-name'] = $contact_record['name']; $datarray['owner-name'] = $contact_record['name'] ?? '';
$datarray['owner-link'] = $contact_record['url']; $datarray['owner-link'] = $contact_record['url'] ?? '';
$datarray['owner-avatar'] = $contact_record['thumb']; $datarray['owner-avatar'] = $contact_record['thumb'] ?? '';
$datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']); $datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']);
$datarray['author-name'] = $author['name']; $datarray['author-name'] = $author['name'];
$datarray['author-link'] = $author['url']; $datarray['author-link'] = $author['url'];
@ -745,8 +745,8 @@ function item_post(App $a) {
FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category'); FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
// These notifications are sent if someone else is commenting other your wall // These notifications are sent if someone else is commenting other your wall
if ($toplevel_item_id) { if ($contact_record != $author) {
if ($contact_record != $author) { if ($toplevel_item_id) {
notification([ notification([
'type' => Type::COMMENT, 'type' => Type::COMMENT,
'notify_flags' => $user['notify-flags'], 'notify_flags' => $user['notify-flags'],
@ -764,9 +764,7 @@ function item_post(App $a) {
'parent' => $toplevel_item_id, 'parent' => $toplevel_item_id,
'parent_uri' => $toplevel_item['uri'] 'parent_uri' => $toplevel_item['uri']
]); ]);
} } elseif (empty($forum_contact)) {
} else {
if (($contact_record != $author) && !count($forum_contact)) {
notification([ notification([
'type' => Type::WALL, 'type' => Type::WALL,
'notify_flags' => $user['notify-flags'], 'notify_flags' => $user['notify-flags'],