Merge pull request from annando/reshare-known-contact

Don't show a reshare in the top of a message if we know the author
This commit is contained in:
Philipp 2019-04-19 15:09:34 +02:00 committed by GitHub
commit 048501be34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -800,6 +800,7 @@ function conversation_fetch_comments($thread_items) {
$lineno = 0; $lineno = 0;
$actor = []; $actor = [];
$created = ''; $created = '';
$knownauthor = false;
while ($row = Item::fetch($thread_items)) { while ($row = Item::fetch($thread_items)) {
if (($row['verb'] == ACTIVITY2_ANNOUNCE) && !empty($row['contact-uid']) && ($row['created'] > $created) && ($row['thr-parent'] == $row['parent-uri'])) { if (($row['verb'] == ACTIVITY2_ANNOUNCE) && !empty($row['contact-uid']) && ($row['created'] > $created) && ($row['thr-parent'] == $row['parent-uri'])) {
@ -808,6 +809,11 @@ function conversation_fetch_comments($thread_items) {
} }
if ($row['gravity'] == GRAVITY_PARENT) { if ($row['gravity'] == GRAVITY_PARENT) {
$parentlines[] = $lineno; $parentlines[] = $lineno;
// We could have several parents, so it has to be done this way.
if (!empty($row['contact-uid']) && in_array($row['network'], Protocol::NATIVE_SUPPORT)) {
$knownauthor = true;
}
} }
$comments[] = $row; $comments[] = $row;
@ -816,7 +822,7 @@ function conversation_fetch_comments($thread_items) {
DBA::close($thread_items); DBA::close($thread_items);
if (!empty($actor)) { if (!$knownauthor && !empty($actor)) {
foreach ($parentlines as $line) { foreach ($parentlines as $line) {
if (!in_array($comments[$line]['network'], [Protocol::DIASPORA]) && !$comments[$line]['origin']) { if (!in_array($comments[$line]['network'], [Protocol::DIASPORA]) && !$comments[$line]['origin']) {
$comments[$line]['owner-link'] = $actor['link']; $comments[$line]['owner-link'] = $actor['link'];