]> git.mxchange.org Git - friendica.git/commitdiff
Account for falsy values for $forum_contact in mod/item
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 4 Jul 2020 19:33:35 +0000 (15:33 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 4 Jul 2020 19:33:35 +0000 (15:33 -0400)
- Rare condition can make it false
- Simplify notification sending condition

mod/item.php

index e56e4c68d963e59c906b90b68578ed5d0c3ee232..08a565e069a6001fce6df5b5d75f3fee1b27ef1f 100644 (file)
@@ -423,7 +423,7 @@ function item_post(App $a) {
 
        $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
                $private = $private_forum;
 
@@ -745,8 +745,8 @@ function item_post(App $a) {
        FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
 
        // 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([
                                'type'         => Type::COMMENT,
                                'notify_flags' => $user['notify-flags'],
@@ -764,9 +764,7 @@ function item_post(App $a) {
                                'parent'       => $toplevel_item_id,
                                'parent_uri'   => $toplevel_item['uri']
                        ]);
-               }
-       } else {
-               if (($contact_record != $author) && !count($forum_contact)) {
+               } elseif (empty($forum_contact)) {
                        notification([
                                'type'         => Type::WALL,
                                'notify_flags' => $user['notify-flags'],