]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
Added post update to remove duplicated contacts
[friendica.git] / src / Model / Item.php
index fbc4a237798e896a41364dfb84820d222be10001..3a421e96c43508d8ad598cc1419ae4cf4707f1ea 100644 (file)
@@ -59,7 +59,7 @@ class Item extends BaseObject
                'event-id', 'event-created', 'event-edited', 'event-start', 'event-finish',
                'event-summary', 'event-desc', 'event-location', 'event-type',
                'event-nofinish', 'event-adjust', 'event-ignore', 'event-id',
-               'delivery_queue_count', 'delivery_queue_done'
+               'delivery_queue_count', 'delivery_queue_done', 'delivery_queue_failed'
        ];
 
        // Field list that is used to deliver items via the protocols
@@ -1243,6 +1243,8 @@ class Item extends BaseObject
        {
                if (!empty($item['contact-id']) && DBA::exists('contact', ['self' => true, 'id' => $item['contact-id']])) {
                        return $item['contact-id'];
+               } elseif (($item['gravity'] == GRAVITY_PARENT) && !empty($item['uid']) && !empty($item['contact-id']) && Contact::isSharing($item['contact-id'], $item['uid'])) {
+                       return $item['contact-id'];
                } elseif (!empty($item['uid']) && !Contact::isSharing($item['author-id'], $item['uid'])) {
                        return $item['author-id'];
                } elseif (!empty($item['contact-id'])) {
@@ -2879,13 +2881,20 @@ class Item extends BaseObject
                return ($recipients1 == $recipients2);
        }
 
-       // returns an array of contact-ids that are allowed to see this object
-       public static function enumeratePermissions(array $obj)
+       /**
+        * Returns an array of contact-ids that are allowed to see this object
+        *
+        * @param array $obj        Item array with at least uid, allow_cid, allow_gid, deny_cid and deny_gid
+        * @param bool  $check_dead Prunes unavailable contacts from the result
+        * @return array
+        * @throws \Exception
+        */
+       public static function enumeratePermissions(array $obj, bool $check_dead = false)
        {
                $allow_people = expand_acl($obj['allow_cid']);
-               $allow_groups = Group::expand($obj['uid'], expand_acl($obj['allow_gid']));
+               $allow_groups = Group::expand($obj['uid'], expand_acl($obj['allow_gid']), $check_dead);
                $deny_people  = expand_acl($obj['deny_cid']);
-               $deny_groups  = Group::expand($obj['uid'], expand_acl($obj['deny_gid']));
+               $deny_groups  = Group::expand($obj['uid'], expand_acl($obj['deny_gid']), $check_dead);
                $recipients   = array_unique(array_merge($allow_people, $allow_groups));
                $deny         = array_unique(array_merge($deny_people, $deny_groups));
                $recipients   = array_diff($recipients, $deny);