]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
Item storage: Permissions aren't stored in the items anymore (#5495)
[friendica.git] / src / Model / Item.php
index e2dc28e8339620424f215a19e6b65c514884ab39..932db885d0eb15194767cb40e05762f875ce6c77 100644 (file)
@@ -514,9 +514,8 @@ class Item extends BaseObject
 
                $fields['item'] = ['id', 'uid', 'parent', 'uri', 'parent-uri', 'thr-parent', 'guid',
                        'contact-id', 'owner-id', 'author-id', 'type', 'wall', 'gravity', 'extid',
-                       'created', 'edited', 'commented', 'received', 'changed',
-                       'resource-id', 'event-id', 'tag', 'attach', 'post-type',
-                       'file', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'psid',
+                       'created', 'edited', 'commented', 'received', 'changed', 'psid',
+                       'resource-id', 'event-id', 'tag', 'attach', 'post-type', 'file',
                        'private', 'pubmail', 'moderated', 'visible', 'starred', 'bookmark',
                        'unseen', 'deleted', 'origin', 'forum_mode', 'mention', 'global',
                        'id' => 'item_id', 'network', 'icid', 'iaid', 'id' => 'internal-iid',
@@ -529,6 +528,8 @@ class Item extends BaseObject
 
                $fields['item-delivery-data'] = self::DELIVERY_DATA_FIELDLIST;
 
+               $fields['permissionset'] = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
+
                $fields['author'] = ['url' => 'author-link', 'name' => 'author-name',
                        'thumb' => 'author-avatar', 'nick' => 'author-nick', 'network' => 'author-network'];
 
@@ -642,6 +643,10 @@ class Item extends BaseObject
                        $joins .= " LEFT JOIN `item-delivery-data` ON `item-delivery-data`.`iid` = `item`.`id`";
                }
 
+               if (strpos($sql_commands, "`permissionset`.") !== false) {
+                       $joins .= " LEFT JOIN `permissionset` ON `permissionset`.`id` = `item`.`psid`";
+               }
+
                if ((strpos($sql_commands, "`parent-item`.") !== false) || (strpos($sql_commands, "`parent-author`.") !== false)) {
                        $joins .= " STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`";
                }
@@ -1648,8 +1653,7 @@ class Item extends BaseObject
                        $files = '';
                }
 
-               // Creates the permission set
-               // Currently we only store the data but don't using it
+               // Creates or assigns the permission set
                $item['psid'] = PermissionSet::fetchIDForPost($item);
 
                // We are doing this outside of the transaction to avoid timing problems