Merge pull request #13172 from annando/parent-view

Increased performance when fetching the parent / fix for displaying contact relations
This commit is contained in:
Hypolite Petovan 2023-05-29 07:46:44 -04:00 committed by GitHub
commit 70674f2ecc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 71 deletions

View file

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 2023.09-dev (Giant Rhubarb) -- Friendica 2023.09-dev (Giant Rhubarb)
-- DB_UPDATE_VERSION 1518 -- DB_UPDATE_VERSION 1519
-- ------------------------------------------ -- ------------------------------------------
@ -1882,7 +1882,7 @@ CREATE VIEW `post-user-view` AS SELECT
`post-user`.`id` AS `id`, `post-user`.`id` AS `id`,
`post-user`.`id` AS `post-user-id`, `post-user`.`id` AS `post-user-id`,
`post-user`.`uid` AS `uid`, `post-user`.`uid` AS `uid`,
`parent-post`.`id` AS `parent`, `post-thread-user`.`post-user-id` AS `parent`,
`item-uri`.`uri` AS `uri`, `item-uri`.`uri` AS `uri`,
`post-user`.`uri-id` AS `uri-id`, `post-user`.`uri-id` AS `uri-id`,
`parent-item-uri`.`uri` AS `parent-uri`, `parent-item-uri`.`uri` AS `parent-uri`,
@ -2025,14 +2025,14 @@ CREATE VIEW `post-user-view` AS SELECT
EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-user`.`uri-id`) AS `has-media`, EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-user`.`uri-id`) AS `has-media`,
`diaspora-interaction`.`interaction` AS `signed_text`, `diaspora-interaction`.`interaction` AS `signed_text`,
`parent-item-uri`.`guid` AS `parent-guid`, `parent-item-uri`.`guid` AS `parent-guid`,
`parent-post`.`network` AS `parent-network`, `post-thread-user`.`network` AS `parent-network`,
`parent-post`.`author-id` AS `parent-author-id`, `post-thread-user`.`author-id` AS `parent-author-id`,
`parent-post-author`.`url` AS `parent-author-link`, `parent-post-author`.`url` AS `parent-author-link`,
`parent-post-author`.`name` AS `parent-author-name`, `parent-post-author`.`name` AS `parent-author-name`,
`parent-post-author`.`nick` AS `parent-author-nick`, `parent-post-author`.`nick` AS `parent-author-nick`,
`parent-post-author`.`network` AS `parent-author-network` `parent-post-author`.`network` AS `parent-author-network`
FROM `post-user` FROM `post-user`
STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid` INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id` STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id` STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id` STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
@ -2050,8 +2050,7 @@ CREATE VIEW `post-user-view` AS SELECT
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin` LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id` LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid` LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid` LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread-user`.`author-id`;
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`;
-- --
-- VIEW post-thread-user-view -- VIEW post-thread-user-view
@ -2061,7 +2060,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
`post-user`.`id` AS `id`, `post-user`.`id` AS `id`,
`post-user`.`id` AS `post-user-id`, `post-user`.`id` AS `post-user-id`,
`post-thread-user`.`uid` AS `uid`, `post-thread-user`.`uid` AS `uid`,
`parent-post`.`id` AS `parent`, `post-thread-user`.`post-user-id` AS `parent`,
`item-uri`.`uri` AS `uri`, `item-uri`.`uri` AS `uri`,
`post-thread-user`.`uri-id` AS `uri-id`, `post-thread-user`.`uri-id` AS `uri-id`,
`parent-item-uri`.`uri` AS `parent-uri`, `parent-item-uri`.`uri` AS `parent-uri`,
@ -2203,11 +2202,12 @@ CREATE VIEW `post-thread-user-view` AS SELECT
EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-user`.`uri-id`) AS `has-media`, EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-user`.`uri-id`) AS `has-media`,
`diaspora-interaction`.`interaction` AS `signed_text`, `diaspora-interaction`.`interaction` AS `signed_text`,
`parent-item-uri`.`guid` AS `parent-guid`, `parent-item-uri`.`guid` AS `parent-guid`,
`parent-post`.`network` AS `parent-network`, `post-thread-user`.`network` AS `parent-network`,
`parent-post`.`author-id` AS `parent-author-id`, `post-thread-user`.`author-id` AS `parent-author-id`,
`parent-post-author`.`url` AS `parent-author-link`, `author`.`url` AS `parent-author-link`,
`parent-post-author`.`name` AS `parent-author-name`, `author`.`name` AS `parent-author-name`,
`parent-post-author`.`network` AS `parent-author-network` `author`.`nick` AS `parent-author-nick`,
`author`.`network` AS `parent-author-network`
FROM `post-thread-user` FROM `post-thread-user`
INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id` INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id` STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
@ -2226,9 +2226,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id` LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin` LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id` LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid` LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`;
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-thread-user`.`uid`
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`;
-- --
-- VIEW post-view -- VIEW post-view
@ -2347,10 +2345,11 @@ CREATE VIEW `post-view` AS SELECT
EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post`.`uri-id`) AS `has-media`, EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post`.`uri-id`) AS `has-media`,
`diaspora-interaction`.`interaction` AS `signed_text`, `diaspora-interaction`.`interaction` AS `signed_text`,
`parent-item-uri`.`guid` AS `parent-guid`, `parent-item-uri`.`guid` AS `parent-guid`,
`parent-post`.`network` AS `parent-network`, `post-thread`.`network` AS `parent-network`,
`parent-post`.`author-id` AS `parent-author-id`, `post-thread`.`author-id` AS `parent-author-id`,
`parent-post-author`.`url` AS `parent-author-link`, `parent-post-author`.`url` AS `parent-author-link`,
`parent-post-author`.`name` AS `parent-author-name`, `parent-post-author`.`name` AS `parent-author-name`,
`parent-post-author`.`nick` AS `parent-author-nick`,
`parent-post-author`.`network` AS `parent-author-network` `parent-post-author`.`network` AS `parent-author-network`
FROM `post` FROM `post`
STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id` STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
@ -2367,8 +2366,7 @@ CREATE VIEW `post-view` AS SELECT
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id` LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id` LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id` LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id` LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread`.`author-id`;
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`;
-- --
-- VIEW post-thread-view -- VIEW post-thread-view
@ -2489,11 +2487,12 @@ CREATE VIEW `post-thread-view` AS SELECT
(SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6) AS `total-actors`, (SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6) AS `total-actors`,
`diaspora-interaction`.`interaction` AS `signed_text`, `diaspora-interaction`.`interaction` AS `signed_text`,
`parent-item-uri`.`guid` AS `parent-guid`, `parent-item-uri`.`guid` AS `parent-guid`,
`parent-post`.`network` AS `parent-network`, `post-thread`.`network` AS `parent-network`,
`parent-post`.`author-id` AS `parent-author-id`, `post-thread`.`author-id` AS `parent-author-id`,
`parent-post-author`.`url` AS `parent-author-link`, `author`.`url` AS `parent-author-link`,
`parent-post-author`.`name` AS `parent-author-name`, `author`.`name` AS `parent-author-name`,
`parent-post-author`.`network` AS `parent-author-network` `author`.`nick` AS `parent-author-nick`,
`author`.`network` AS `parent-author-network`
FROM `post-thread` FROM `post-thread`
INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id` INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id` STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
@ -2508,9 +2507,7 @@ CREATE VIEW `post-thread-view` AS SELECT
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id` LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id` LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id` LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id` LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`;
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`;
-- --
-- VIEW category-view -- VIEW category-view
@ -2587,7 +2584,7 @@ CREATE VIEW `tag-view` AS SELECT
DROP VIEW IF EXISTS `network-item-view`; DROP VIEW IF EXISTS `network-item-view`;
CREATE VIEW `network-item-view` AS SELECT CREATE VIEW `network-item-view` AS SELECT
`post-user`.`uri-id` AS `uri-id`, `post-user`.`uri-id` AS `uri-id`,
`parent-post`.`id` AS `parent`, `post-thread-user`.`post-user-id` AS `parent`,
`post-user`.`received` AS `received`, `post-user`.`received` AS `received`,
`post-thread-user`.`commented` AS `commented`, `post-thread-user`.`commented` AS `commented`,
`post-user`.`created` AS `created`, `post-user`.`created` AS `created`,
@ -2600,12 +2597,11 @@ CREATE VIEW `network-item-view` AS SELECT
`post-user`.`contact-id` AS `contact-id`, `post-user`.`contact-id` AS `contact-id`,
`ownercontact`.`contact-type` AS `contact-type` `ownercontact`.`contact-type` AS `contact-type`
FROM `post-user` FROM `post-user`
STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid` INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id` INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id` LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id` LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id` INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
WHERE `post-user`.`visible` AND NOT `post-user`.`deleted` WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`) AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`) AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
@ -2618,7 +2614,7 @@ CREATE VIEW `network-item-view` AS SELECT
DROP VIEW IF EXISTS `network-thread-view`; DROP VIEW IF EXISTS `network-thread-view`;
CREATE VIEW `network-thread-view` AS SELECT CREATE VIEW `network-thread-view` AS SELECT
`post-thread-user`.`uri-id` AS `uri-id`, `post-thread-user`.`uri-id` AS `uri-id`,
`parent-post`.`id` AS `parent`, `post-thread-user`.`post-user-id` AS `parent`,
`post-thread-user`.`received` AS `received`, `post-thread-user`.`received` AS `received`,
`post-thread-user`.`commented` AS `commented`, `post-thread-user`.`commented` AS `commented`,
`post-thread-user`.`created` AS `created`, `post-thread-user`.`created` AS `created`,
@ -2634,7 +2630,6 @@ CREATE VIEW `network-thread-view` AS SELECT
LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id` LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id` LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id` LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
WHERE `post-user`.`visible` AND NOT `post-user`.`deleted` WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`) AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`) AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)

View file

@ -27,7 +27,6 @@ use Friendica\Core\Protocol;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\ItemURI; use Friendica\Model\ItemURI;
@ -95,13 +94,14 @@ class User
$update_fields = self::preparedFields($fields); $update_fields = self::preparedFields($fields);
if (!empty($update_fields)) { if (!empty($update_fields)) {
$contacts = DBA::select('contact', ['uri-id', 'uid'], $condition); $contacts = DBA::select('account-user-view', ['pid', 'uri-id', 'uid'], $condition);
while ($contact = DBA::fetch($contacts)) { while ($contact = DBA::fetch($contacts)) {
if (empty($contact['uri-id']) || empty($contact['uid'])) { if (empty($contact['uri-id']) || empty($contact['uid'])) {
continue; continue;
} }
$ret = DBA::update('user-contact', $update_fields, ['uri-id' => $contact['uri-id'], 'uid' => $contact['uid']]); $update_fields['cid'] = $contact['pid'];
Logger::info('Updated user contact', ['uid' => $contact['uid'], 'uri-id' => $contact['uri-id'], 'ret' => $ret]); $ret = DBA::update('user-contact', $update_fields, ['uri-id' => $contact['uri-id'], 'uid' => $contact['uid']], true);
Logger::info('Updated user contact', ['uid' => $contact['uid'], 'id' => $contact['pid'], 'uri-id' => $contact['uri-id'], 'ret' => $ret]);
} }
DBA::close($contacts); DBA::close($contacts);

View file

@ -246,7 +246,7 @@ class Profile extends BaseModule
$relation_text = ''; $relation_text = '';
} }
if (!in_array($contact['network'], array_merge(Protocol::FEDERATED, [Protocol::TWITTER]))) { if (!Protocol::supportsFollow($contact['network'])) {
$relation_text = ''; $relation_text = '';
} }

View file

@ -55,7 +55,7 @@
use Friendica\Database\DBA; use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) { if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1518); define('DB_UPDATE_VERSION', 1519);
} }
return [ return [

View file

@ -63,7 +63,7 @@
"id" => ["post-user", "id"], "id" => ["post-user", "id"],
"post-user-id" => ["post-user", "id"], "post-user-id" => ["post-user", "id"],
"uid" => ["post-user", "uid"], "uid" => ["post-user", "uid"],
"parent" => ["parent-post", "id"], "parent" => ["post-thread-user", "post-user-id"],
"uri" => ["item-uri", "uri"], "uri" => ["item-uri", "uri"],
"uri-id" => ["post-user", "uri-id"], "uri-id" => ["post-user", "uri-id"],
"parent-uri" => ["parent-item-uri", "uri"], "parent-uri" => ["parent-item-uri", "uri"],
@ -206,15 +206,15 @@
"has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-user`.`uri-id`)", "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-user`.`uri-id`)",
"signed_text" => ["diaspora-interaction", "interaction"], "signed_text" => ["diaspora-interaction", "interaction"],
"parent-guid" => ["parent-item-uri", "guid"], "parent-guid" => ["parent-item-uri", "guid"],
"parent-network" => ["parent-post", "network"], "parent-network" => ["post-thread-user", "network"],
"parent-author-id" => ["parent-post", "author-id"], "parent-author-id" => ["post-thread-user", "author-id"],
"parent-author-link" => ["parent-post-author", "url"], "parent-author-link" => ["parent-post-author", "url"],
"parent-author-name" => ["parent-post-author", "name"], "parent-author-name" => ["parent-post-author", "name"],
"parent-author-nick" => ["parent-post-author", "nick"], "parent-author-nick" => ["parent-post-author", "nick"],
"parent-author-network" => ["parent-post-author", "network"], "parent-author-network" => ["parent-post-author", "network"],
], ],
"query" => "FROM `post-user` "query" => "FROM `post-user`
STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid` INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id` STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id` STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id` STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
@ -232,15 +232,14 @@
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin` LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id` LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid` LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid` LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread-user`.`author-id`"
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
], ],
"post-thread-user-view" => [ "post-thread-user-view" => [
"fields" => [ "fields" => [
"id" => ["post-user", "id"], "id" => ["post-user", "id"],
"post-user-id" => ["post-user", "id"], "post-user-id" => ["post-user", "id"],
"uid" => ["post-thread-user", "uid"], "uid" => ["post-thread-user", "uid"],
"parent" => ["parent-post", "id"], "parent" => ["post-thread-user", "post-user-id"],
"uri" => ["item-uri", "uri"], "uri" => ["item-uri", "uri"],
"uri-id" => ["post-thread-user", "uri-id"], "uri-id" => ["post-thread-user", "uri-id"],
"parent-uri" => ["parent-item-uri", "uri"], "parent-uri" => ["parent-item-uri", "uri"],
@ -382,11 +381,12 @@
"has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-user`.`uri-id`)", "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-user`.`uri-id`)",
"signed_text" => ["diaspora-interaction", "interaction"], "signed_text" => ["diaspora-interaction", "interaction"],
"parent-guid" => ["parent-item-uri", "guid"], "parent-guid" => ["parent-item-uri", "guid"],
"parent-network" => ["parent-post", "network"], "parent-network" => ["post-thread-user", "network"],
"parent-author-id" => ["parent-post", "author-id"], "parent-author-id" => ["post-thread-user", "author-id"],
"parent-author-link" => ["parent-post-author", "url"], "parent-author-link" => ["author", "url"],
"parent-author-name" => ["parent-post-author", "name"], "parent-author-name" => ["author", "name"],
"parent-author-network" => ["parent-post-author", "network"], "parent-author-nick" => ["author", "nick"],
"parent-author-network" => ["author", "network"],
], ],
"query" => "FROM `post-thread-user` "query" => "FROM `post-thread-user`
INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id` INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
@ -406,9 +406,7 @@
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id` LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin` LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id` LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid` LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`"
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-thread-user`.`uid`
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
], ],
"post-view" => [ "post-view" => [
"fields" => [ "fields" => [
@ -524,10 +522,11 @@
"has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post`.`uri-id`)", "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post`.`uri-id`)",
"signed_text" => ["diaspora-interaction", "interaction"], "signed_text" => ["diaspora-interaction", "interaction"],
"parent-guid" => ["parent-item-uri", "guid"], "parent-guid" => ["parent-item-uri", "guid"],
"parent-network" => ["parent-post", "network"], "parent-network" => ["post-thread", "network"],
"parent-author-id" => ["parent-post", "author-id"], "parent-author-id" => ["post-thread", "author-id"],
"parent-author-link" => ["parent-post-author", "url"], "parent-author-link" => ["parent-post-author", "url"],
"parent-author-name" => ["parent-post-author", "name"], "parent-author-name" => ["parent-post-author", "name"],
"parent-author-nick" => ["parent-post-author", "nick"],
"parent-author-network" => ["parent-post-author", "network"], "parent-author-network" => ["parent-post-author", "network"],
], ],
"query" => "FROM `post` "query" => "FROM `post`
@ -545,8 +544,7 @@
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id` LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id` LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id` LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id` LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread`.`author-id`"
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
], ],
"post-thread-view" => [ "post-thread-view" => [
"fields" => [ "fields" => [
@ -664,11 +662,12 @@
"total-actors" => "(SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)", "total-actors" => "(SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
"signed_text" => ["diaspora-interaction", "interaction"], "signed_text" => ["diaspora-interaction", "interaction"],
"parent-guid" => ["parent-item-uri", "guid"], "parent-guid" => ["parent-item-uri", "guid"],
"parent-network" => ["parent-post", "network"], "parent-network" => ["post-thread", "network"],
"parent-author-id" => ["parent-post", "author-id"], "parent-author-id" => ["post-thread", "author-id"],
"parent-author-link" => ["parent-post-author", "url"], "parent-author-link" => ["author", "url"],
"parent-author-name" => ["parent-post-author", "name"], "parent-author-name" => ["author", "name"],
"parent-author-network" => ["parent-post-author", "network"], "parent-author-nick" => ["author", "nick"],
"parent-author-network" => ["author", "network"],
], ],
"query" => "FROM `post-thread` "query" => "FROM `post-thread`
INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id` INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
@ -684,9 +683,7 @@
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id` LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id` LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id` LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id` LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`"
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
], ],
"category-view" => [ "category-view" => [
"fields" => [ "fields" => [
@ -752,7 +749,7 @@
"network-item-view" => [ "network-item-view" => [
"fields" => [ "fields" => [
"uri-id" => ["post-user", "uri-id"], "uri-id" => ["post-user", "uri-id"],
"parent" => ["parent-post", "id"], "parent" => ["post-thread-user", "post-user-id"],
"received" => ["post-user", "received"], "received" => ["post-user", "received"],
"commented" => ["post-thread-user", "commented"], "commented" => ["post-thread-user", "commented"],
"created" => ["post-user", "created"], "created" => ["post-user", "created"],
@ -766,12 +763,11 @@
"contact-type" => ["ownercontact", "contact-type"], "contact-type" => ["ownercontact", "contact-type"],
], ],
"query" => "FROM `post-user` "query" => "FROM `post-user`
STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid` INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id` INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id` LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id` LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id` INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
WHERE `post-user`.`visible` AND NOT `post-user`.`deleted` WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`) AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`) AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
@ -781,7 +777,7 @@
"network-thread-view" => [ "network-thread-view" => [
"fields" => [ "fields" => [
"uri-id" => ["post-thread-user", "uri-id"], "uri-id" => ["post-thread-user", "uri-id"],
"parent" => ["parent-post", "id"], "parent" => ["post-thread-user", "post-user-id"],
"received" => ["post-thread-user", "received"], "received" => ["post-thread-user", "received"],
"commented" => ["post-thread-user", "commented"], "commented" => ["post-thread-user", "commented"],
"created" => ["post-thread-user", "created"], "created" => ["post-thread-user", "created"],
@ -798,7 +794,6 @@
LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id` LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id` LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id` LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
WHERE `post-user`.`visible` AND NOT `post-user`.`deleted` WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`) AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`) AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)