]> git.mxchange.org Git - friendica.git/commitdiff
The item view is completed, unneeded fields removed
authorMichael <heluecht@pirati.ca>
Wed, 13 Jan 2021 07:23:57 +0000 (07:23 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 13 Jan 2021 07:23:57 +0000 (07:23 +0000)
src/Model/Item.php
src/Protocol/Diaspora.php
static/dbview.config.php

index e4266b41ee0f3cee0ec353bc81ba65f14bceeb57..ee30f41ca0723777934d7ed541fa5caeaee6e9d0 100644 (file)
@@ -96,7 +96,7 @@ class Item
                        'deleted', 'extid', 'post-type', 'gravity',
                        'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
                        'author-id', 'author-link', 'owner-link', 'contact-uid',
-                       'signed_text', 'signature', 'signer', 'network'];
+                       'signed_text', 'network'];
 
        // Field list for "item-content" table that is mixed with the item table
        const MIXED_CONTENT_FIELDLIST = ['title', 'content-warning', 'body', 'location',
index 269d62386887bd1580043de2d6e519f894d6c068..90c6e12edd20b6806c10e1ad87dd58181e77d4d0 100644 (file)
@@ -3700,51 +3700,6 @@ class Diaspora
                return self::buildAndTransmit($owner, $contact, $type, $message, $public_batch, $item["guid"]);
        }
 
-       /**
-        * Creates a message from a signature record entry
-        *
-        * @param array $item The item that will be exported
-        * @return array The message
-        */
-       private static function messageFromSignature(array $item)
-       {
-               // Split the signed text
-               $signed_parts = explode(";", $item['signed_text']);
-
-               if ($item["deleted"]) {
-                       $message = ["author" => $item['signer'],
-                                       "target_guid" => $signed_parts[0],
-                                       "target_type" => $signed_parts[1]];
-               } elseif (in_array($item["verb"], [Activity::LIKE, Activity::DISLIKE])) {
-                       $message = ["author" => $signed_parts[4],
-                                       "guid" => $signed_parts[1],
-                                       "parent_guid" => $signed_parts[3],
-                                       "parent_type" => $signed_parts[2],
-                                       "positive" => $signed_parts[0],
-                                       "author_signature" => $item['signature'],
-                                       "parent_author_signature" => ""];
-               } else {
-                       // Remove the comment guid
-                       $guid = array_shift($signed_parts);
-
-                       // Remove the parent guid
-                       $parent_guid = array_shift($signed_parts);
-
-                       // Remove the handle
-                       $handle = array_pop($signed_parts);
-
-                       $message = [
-                               "author" => $handle,
-                               "guid" => $guid,
-                               "parent_guid" => $parent_guid,
-                               "text" => implode(";", $signed_parts),
-                               "author_signature" => $item['signature'],
-                               "parent_author_signature" => ""
-                       ];
-               }
-               return $message;
-       }
-
        /**
         * Relays messages (like, comment, retraction) to other servers if we are the thread owner
         *
index cd835ddfae22ecc98cdaf4be93fb93d90b554c06..ff8769a196b2a53413306c35280fdd70997f6d4d 100644 (file)
  */
 
 return [
-       "item-view" => [
+       "post-view" => [
                "fields" => [
-                       "id" => ["item", "id"], 
-                       "item_id" => ["item", "id"], 
-                       "uid" => ["item", "uid"], 
-                       "parent" => ["item", "parent"], 
-                       "uri" => ["item", "uri"], 
-                       "parent-uri" => ["item", "parent-uri"], 
+                       "id" => ["item", "id"],
+                       "item_id" => ["item", "id"],
+                       "uid" => ["item", "uid"],
+                       "parent" => ["item", "parent"],
+                       "uri" => ["item", "uri"],
+                       "parent-uri" => ["item", "parent-uri"],
                        "thr-parent" => ["item", "thr-parent"],
-                       "guid" => ["item", "guid"], 
-                       "uri-id" => ["item", "uri-id"], 
-                       "parent-uri-id" => ["item", "parent-uri-id"], 
+                       "guid" => ["item", "guid"],
+                       "uri-id" => ["item", "uri-id"],
+                       "parent-uri-id" => ["item", "parent-uri-id"],
                        "thr-parent-id" => ["item", "thr-parent-id"],
-                       "contact-id" => ["item", "contact-id"], 
-                       "type" => ["item", "type"], 
-                       "wall" => ["item", "wall"], 
-                       "gravity" => ["item", "gravity"], 
-                       "extid" => ["item", "extid"], 
-                       "iaid" => ["item", "iaid"],
+                       "contact-id" => ["item", "contact-id"],
+                       "contact-uid" => ["contact", "uid"],
+                       "contact-link" => ["contact", "url"],
+                       "contact-name" => ["contact", "name"],
+                       "contact-avatar" => ["contact", "thumb"],
+                       "writable" => ["contact", "writable"],
+                       "self" => ["contact", "self"],
+                       "cid" => ["contact", "id"],
+                       "alias" => ["contact", "alias"],
+                       "photo" => ["contact", "photo"],
+                       "name-date" => ["contact", "name-date"],
+                       "uri-date" => ["contact", "uri-date"],
+                       "avatar-date" => ["contact", "avatar-date"],
+                       "thumb" => ["contact", "thumb"],
+                       "dfrn-id" => ["contact", "dfrn-id"],
+                       "type" => ["item", "type"],
+                       "wall" => ["item", "wall"],
+                       "gravity" => ["item", "gravity"],
+                       "extid" => ["item", "extid"],
                        "icid" => ["item", "icid"],
+                       "vid" => ["item", "vid"],
                        "psid" => ["item", "psid"],
-                       "created" => ["item", "created"], 
-                       "edited" => ["item", "edited"], 
-                       "commented" => ["item", "commented"], 
-                       "received" => ["item", "received"], 
-                       "changed" => ["item", "changed"], 
-                       "verb" => ["item-content", "verb"], 
-                       "plink" => ["item-content", "plink"], 
+                       "created" => ["item", "created"],
+                       "edited" => ["item", "edited"],
+                       "commented" => ["item", "commented"],
+                       "received" => ["item", "received"],
+                       "changed" => ["item", "changed"],
+                       "verb" => ["verb", "name"],
+                       "plink" => ["item-content", "plink"],
                        "language" => ["item-content", "language"],
-                       "resource-id" => ["item", "resource-id"], 
-                       "event-id" => ["item", "event-id"], 
-                       "attach" => ["item", "attach"], 
-                       "postopts" => ["post-delivery-data", "postopts"], 
-                       "inform" => ["post-delivery-data", "inform"], 
-                       "file" => "NULL", 
-                       "allow_cid" => ["permissionset", "allow_cid"], 
-                       "allow_gid" => ["permissionset", "allow_gid"], 
-                       "deny_cid" => ["permissionset", "deny_cid"], 
-                       "deny_gid" => ["permissionset", "deny_gid"], 
-                       "post-type" => ["item", "post-type"], 
-                       "private" => ["item", "private"], 
-                       "pubmail" => ["item", "pubmail"], 
-                       "moderated" => ["item", "moderated"], 
-                       "visible" => ["item", "visible"], 
-                       "starred" => ["item", "starred"], 
-                       "bookmark" => ["thread", "bookmark"], 
-                       "unseen" => ["item", "unseen"], 
-                       "deleted" => ["item", "deleted"], 
-                       "origin" => ["item", "origin"], 
-                       "forum_mode" => ["item", "forum_mode"], 
-                       "mention" => ["item", "mention"], 
-                       "global" => ["item", "global"], 
-                       "network" => ["item", "network"], 
-                       "title" => ["item-content", "title"], 
-                       "content-warning" => ["item-content", "content-warning"], 
-                       "body" => ["item-content", "body"], 
-                       "location" => ["item-content", "location"], 
-                       "coord" => ["item-content", "coord"], 
-                       "app" => ["item-content", "app"], 
-                       "rendered-hash" => ["item-content", "rendered-hash"], 
-                       "rendered-html" => ["item-content", "rendered-html"], 
-                       "object-type" => ["item-content", "object-type"], 
-                       "object" => ["item-content", "object"], 
-                       "target-type" => ["item-content", "target-type"], 
-                       "target" => ["item-content", "target"], 
-                       "author-id" => ["item", "author-id"], 
-                       "author-link" => ["author", "url"], 
-                       "author-name" => ["author", "name"], 
-                       "author-avatar" => ["author", "thumb"], 
-                       "author-network" => ["author", "network"], 
-                       "owner-id" => ["item", "owner-id"], 
-                       "owner-link" => ["owner", "url"], 
-                       "owner-addr" => ["owner", "addr"], 
-                       "owner-avatar"  => ["owner", "thumb"],
-                       "owner-nick" => ["owner", "nick"], 
-                       "owner-name" => ["owner", "name"], 
+                       "raw-body" => ["item-content", "raw-body"],
+                       "resource-id" => ["item", "resource-id"],
+                       "event-id" => ["item", "event-id"],
+                       "attach" => ["item", "attach"],
+                       "postopts" => ["post-delivery-data", "postopts"],
+                       "inform" => ["post-delivery-data", "inform"],
+                       "file" => "NULL",
+                       "allow_cid" => ["permissionset", "allow_cid"],
+                       "allow_gid" => ["permissionset", "allow_gid"],
+                       "deny_cid" => ["permissionset", "deny_cid"],
+                       "deny_gid" => ["permissionset", "deny_gid"],
+                       "post-type" => ["item", "post-type"],
+                       "private" => ["item", "private"],
+                       "pubmail" => ["item", "pubmail"],
+                       "moderated" => ["item", "moderated"],
+                       "visible" => ["item", "visible"],
+                       "starred" => ["item", "starred"],
+                       "bookmark" => ["item", "bookmark"],
+                       "unseen" => ["item", "unseen"],
+                       "deleted" => ["item", "deleted"],
+                       "origin" => ["item", "origin"],
+                       "forum_mode" => ["item", "forum_mode"],
+                       "mention" => ["item", "mention"],
+                       "global" => ["item", "global"],
+                       "network" => ["item", "network"],
+                       "title" => ["item-content", "title"],
+                       "content-warning" => ["item-content", "content-warning"],
+                       "body" => ["item-content", "body"],
+                       "location" => ["item-content", "location"],
+                       "coord" => ["item-content", "coord"],
+                       "app" => ["item-content", "app"],
+                       "rendered-hash" => ["item-content", "rendered-hash"],
+                       "rendered-html" => ["item-content", "rendered-html"],
+                       "object-type" => ["item-content", "object-type"],
+                       "object" => ["item-content", "object"],
+                       "target-type" => ["item-content", "target-type"],
+                       "target" => ["item-content", "target"],
+                       "author-id" => ["item", "author-id"],
+                       "author-link" => ["author", "url"],
+                       "author-addr" => ["author", "addr"],
+                       "author-name" => ["author", "name"],
+                       "author-nick" => ["author", "nick"],
+                       "author-avatar" => ["author", "thumb"],
+                       "author-network" => ["author", "network"],
+                       "owner-id" => ["item", "owner-id"],
+                       "owner-link" => ["owner", "url"],
+                       "owner-addr" => ["owner", "addr"],
+                       "owner-avatar" => ["owner", "thumb"],
+                       "owner-nick" => ["owner", "nick"],
+                       "owner-name" => ["owner", "name"],
                        "owner-network" => ["owner", "network"],
-                       "contact-uid" => ["contact", "uid"],
+                       "causer-id" => ["item", "causer-id"],
+                       "causer-link" => ["causer", "url"],
+                       "causer-addr" => ["causer", "addr"],
+                       "causer-name" => ["causer", "name"],
+                       "causer-nick" => ["causer", "nick"], 
+                       "causer-avatar" => ["causer", "thumb"],
+                       "causer-network" => ["causer", "network"],
+                       "causer-contact-type" => ["causer", "contact-type"],
+                       "event-id" => ["event"."id"],
+                       "event-created" => ["event"."created"],
+                       "event-edited" => ["event"."edited"],
+                       "event-start" => ["event"."start"],
+                       "event-finish" => ["event"."finish"],
+                       "event-summary" => ["event"."summary"],
+                       "event-desc" => ["event"."id"],
+                       "event-location" => ["event"."location"],
+                       "event-type" => ["event"."type"],
+                       "event-nofinish" => ["event"."nofinish"],
+                       "event-adjust" => ["event"."adjust"],
+                       "event-ignore" => ["event"."ignore"],
+                       "delivery_queue_count" => ["post-delivery-data"."queue_count"],
+                       "delivery_queue_done" => ["post-delivery-data"."queue_done"],
+                       "delivery_queue_failed" => ["post-delivery-data"."queue_failed"],
                        "parent-guid" => ["parent-item", "guid"],
                        "parent-network" => ["parent-item", "network"],
+                       "parent-author-id" => ["parent-item", "author-id"],
+                       "parent-author-link" => ["parent-item-author", "url"],  
+                       "parent-author-name" => ["parent-item-author", "name"],
+                       "parent-author-network" => ["parent-item-author", "network"], 
                        "signed_text" => ["diaspora-interaction", "interaction"],
-                       "signature" => "NULL",
-                       "signer" => "NULL"
                ],
                "query" => "FROM `item`
                        LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                        LEFT JOIN `contact` AS `author` ON `author`.`id` = `item`.`author-id`
                        LEFT JOIN `contact` AS `owner` ON `owner`.`id` = `item`.`owner-id`
+                       LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `item`.`causer-id`
+                       STRAIGHT_JOIN `group_member` ON `group_member`.`contact-id` = `item`.`contact-id`
+                       STRAIGHT_JOIN `user` ON `user`.`uid` = `item`.`uid`
+                       LEFT JOIN `event` ON `event-id` = `event`.`id`
                        LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `item`.`uri-id`
-                       LEFT JOIN `item-activity` ON `item-activity`.`uri-id` = `item`.`uri-id`
                        LEFT JOIN `item-content` ON `item-content`.`uri-id` = `item`.`uri-id`
                        LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `item`.`uri-id` AND `item`.`origin`
+                       LEFT JOIN `verb` ON `verb`.`id` = `item`.`vid`
                        LEFT JOIN `permissionset` ON `permissionset`.`id` = `item`.`psid`
-                       LEFT JOIN `thread` ON `thread`.`iid` = `item`.`parent`
-                       STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`"
+                       STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`
+                       STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`"
        ],
        "category-view" => [
                "fields" => [