The item view is completed, unneeded fields removed

This commit is contained in:
Michael 2021-01-13 07:23:57 +00:00
parent 122ad0af14
commit ca16a4892b
3 changed files with 125 additions and 125 deletions

View 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',

View 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
*

View file

@ -37,7 +37,7 @@
*/
return [
"item-view" => [
"post-view" => [
"fields" => [
"id" => ["item", "id"],
"item_id" => ["item", "id"],
@ -51,21 +51,36 @@ return [
"parent-uri-id" => ["item", "parent-uri-id"],
"thr-parent-id" => ["item", "thr-parent-id"],
"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"],
"iaid" => ["item", "iaid"],
"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"],
"verb" => ["verb", "name"],
"plink" => ["item-content", "plink"],
"language" => ["item-content", "language"],
"raw-body" => ["item-content", "raw-body"],
"resource-id" => ["item", "resource-id"],
"event-id" => ["item", "event-id"],
"attach" => ["item", "attach"],
@ -82,7 +97,7 @@ return [
"moderated" => ["item", "moderated"],
"visible" => ["item", "visible"],
"starred" => ["item", "starred"],
"bookmark" => ["thread", "bookmark"],
"bookmark" => ["item", "bookmark"],
"unseen" => ["item", "unseen"],
"deleted" => ["item", "deleted"],
"origin" => ["item", "origin"],
@ -104,34 +119,64 @@ return [
"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-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" => [