Merge pull request #9609 from annando/contact-reshare

Display posts that are reshared by the contact
This commit is contained in:
Hypolite Petovan 2020-11-29 15:55:51 -05:00 committed by GitHub
commit 63b1c18e44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1304,8 +1304,8 @@ class Contact
$contact_field = ((($contact["contact-type"] == self::TYPE_COMMUNITY) || ($contact['network'] == Protocol::MAIL)) ? 'owner-id' : 'author-id'); $contact_field = ((($contact["contact-type"] == self::TYPE_COMMUNITY) || ($contact['network'] == Protocol::MAIL)) ? 'owner-id' : 'author-id');
if ($thread_mode) { if ($thread_mode) {
$condition = ["(`$contact_field` = ? OR (`causer-id` = ? AND `post-type` = ?)) AND `gravity` = ? AND " . $sql, $condition = ["((`$contact_field` = ? AND `gravity` = ?) OR (`author-id` = ? AND `gravity` = ? AND `vid` = ?)) AND " . $sql,
$cid, $cid, Item::PT_ANNOUNCEMENT, GRAVITY_PARENT, local_user()]; $cid, GRAVITY_PARENT, $cid, GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), local_user()];
} else { } else {
$condition = ["`$contact_field` = ? AND `gravity` IN (?, ?) AND " . $sql, $condition = ["`$contact_field` = ? AND `gravity` IN (?, ?) AND " . $sql,
$cid, GRAVITY_PARENT, GRAVITY_COMMENT, local_user()]; $cid, GRAVITY_PARENT, GRAVITY_COMMENT, local_user()];
@ -1341,15 +1341,9 @@ class Contact
} }
if ($thread_mode) { if ($thread_mode) {
$r = Item::selectForUser(local_user(), ['uri', 'gravity', 'parent-uri'], $condition, $params); $r = Item::selectForUser(local_user(), ['uri', 'gravity', 'parent-uri', 'thr-parent-id', 'author-id'], $condition, $params);
$items = []; $items = [];
while ($item = DBA::fetch($r)) { while ($item = DBA::fetch($r)) {
if ($item['gravity'] != GRAVITY_PARENT) {
$item['uri'] = $item['parent-uri'];
}
unset($item['parent-uri']);
unset($item['gravity']);
$items[] = $item; $items[] = $item;
} }
DBA::close($r); DBA::close($r);