"item" is replaced by "post-view" / postupdate check added

This commit is contained in:
Michael 2021-01-17 20:32:13 +00:00
parent d29bad0cb2
commit 4157db5473
28 changed files with 104 additions and 782 deletions

View file

@ -62,11 +62,11 @@ class PublicTimeline extends BaseApi
'uid' => 0, 'network' => Protocol::FEDERATED];
if ($local) {
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `item` WHERE `origin`)"]);
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-view` WHERE `origin`)"]);
}
if ($remote) {
$condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `item` WHERE `origin`)"]);
$condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-view` WHERE `origin`)"]);
}
if (!empty($max_id)) {

View file

@ -181,7 +181,7 @@ class Status extends BaseProfile
$condition = DBA::mergeConditions($condition, ["((`gravity` = ? AND `wall`) OR
(`gravity` = ? AND `vid` = ? AND `origin` AND `thr-parent-id` IN
(SELECT `uri-id` FROM `item` AS `i`
(SELECT `uri-id` FROM `post-view` AS `i`
WHERE `gravity` = ? AND `network` IN (?, ?, ?, ?) AND `uid` IN (?, ?)
AND `i`.`uri-id` = `thr-parent-id`)))",
GRAVITY_PARENT, GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), GRAVITY_PARENT,

View file

@ -71,27 +71,18 @@ class Profile extends BaseModule
// If the page user is the owner of the page we should query for unseen
// items. Otherwise use a timestamp of the last succesful update request.
if ($is_owner || !$last_updated) {
$sql_extra4 = " AND `item`.`unseen`";
$sql_extra4 = " AND `unseen`";
} else {
$gmupdate = gmdate(DateTimeFormat::MYSQL, $last_updated);
$sql_extra4 = " AND `item`.`received` > '" . $gmupdate . "'";
$sql_extra4 = " AND `received` > '" . $gmupdate . "'";
}
$items_stmt = DBA::p(
"SELECT DISTINCT(`parent-uri`) AS `uri`, `item`.`created`
FROM `item`
INNER JOIN `contact`
ON `contact`.`id` = `item`.`contact-id`
AND NOT `contact`.`blocked`
AND NOT `contact`.`pending`
WHERE `item`.`uid` = ?
AND `item`.`visible`
AND (NOT `item`.`deleted` OR `item`.`gravity` = ?)
AND NOT `item`.`moderated`
AND `item`.`wall`
$sql_extra4
$sql_extra
ORDER BY `item`.`received` DESC",
"SELECT DISTINCT(`parent-uri`) AS `uri`, `created` FROM `post-view`
WHERE `uid` = ? AND NOT `contact-blocked` AND NOT `contact-pending`
AND `visible` AND (NOT `deleted` OR `gravity` = ?)
AND NOT `moderated` AND `wall` $sql_extra4 $sql_extra
ORDER BY `received` DESC",
$a->profile['uid'],
GRAVITY_ACTIVITY
);