]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
Issue 8371: More enhanced logging
[friendica.git] / src / Model / Item.php
index fe62e888d0d3d03fa2616655c7ab9ab2ef5e1d5c..f5b626b426e498c148748ed06209df5824d9a11b 100644 (file)
@@ -44,6 +44,7 @@ use Friendica\Util\Strings;
 use Friendica\Util\XML;
 use Friendica\Worker\Delivery;
 use Text_LanguageDetect;
+use Friendica\Repository\PermissionSet as RepPermissionSet;
 
 class Item
 {
@@ -326,6 +327,21 @@ class Item
                        }
                }
 
+               if ($row['internal-psid'] == RepPermissionSet::PUBLIC) {
+                       if (array_key_exists('allow_cid', $row)) {
+                               $row['allow_cid'] = '';
+                       }
+                       if (array_key_exists('allow_gid', $row)) {
+                               $row['allow_gid'] = '';
+                       }
+                       if (array_key_exists('deny_cid', $row)) {
+                               $row['deny_cid'] = '';
+                       }
+                       if (array_key_exists('deny_gid', $row)) {
+                               $row['deny_gid'] = '';
+                       }
+               }
+
                if (array_key_exists('signed_text', $row) && array_key_exists('interaction', $row) && !is_null($row['interaction'])) {
                        $row['signed_text'] = $row['interaction'];
                }
@@ -338,6 +354,7 @@ class Item
                unset($row['internal-activity']);
                unset($row['internal-network']);
                unset($row['internal-iid']);
+               unset($row['internal-psid']);
                unset($row['internal-iaid']);
                unset($row['internal-icid']);
                unset($row['internal-user-ignored']);
@@ -664,7 +681,7 @@ class Item
                        'unseen', 'deleted', 'origin', 'forum_mode', 'mention', 'global',
                        'id' => 'item_id', 'network', 'icid', 'iaid', 'id' => 'internal-iid',
                        'network' => 'internal-network', 'icid' => 'internal-icid',
-                       'iaid' => 'internal-iaid'];
+                       'iaid' => 'internal-iaid', 'psid' => 'internal-psid'];
 
                if ($usermode) {
                        $fields['user-item'] = ['pinned', 'notification-type', 'ignored' => 'internal-user-ignored'];
@@ -833,6 +850,7 @@ class Item
        {
                if (!empty($selected)) {
                        $selected[] = 'internal-iid';
+                       $selected[] = 'internal-psid';                  
                        $selected[] = 'internal-iaid';
                        $selected[] = 'internal-icid';
                        $selected[] = 'internal-network';
@@ -1695,7 +1713,7 @@ class Item
 
                        $fields = ['uri', 'parent-uri', 'id', 'deleted',
                                'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
-                               'wall', 'private', 'forum_mode', 'origin'];
+                               'wall', 'private', 'forum_mode', 'origin', 'author-id'];
                        $condition = ['uri' => $item['parent-uri'], 'uid' => $item['uid']];
                        $params = ['order' => ['id' => false]];
                        $parent = self::selectFirst($fields, $condition, $params);
@@ -1750,6 +1768,11 @@ class Item
                                        DBA::update('thread', ['mention' => true], ['iid' => $parent_id]);
                                        Logger::log('tagged thread ' . $parent_id . ' as mention for user ' . $item['uid'], Logger::DEBUG);
                                }
+
+                               // Update the contact relations
+                               if ($item['author-id'] != $parent['author-id']) {
+                                       DBA::update('contact-relation', ['last-interaction' => $item['created']], ['cid' => $parent['author-id'], 'relation-cid' => $item['author-id']], true);
+                               }
                        } else {
                                /*
                                 * Allow one to see reply tweets from status.net even when