Merge pull request #9057 from annando/issue-9051

Issue 9051: Only change the owner of posts reshared by forums
This commit is contained in:
Hypolite Petovan 2020-08-23 06:44:41 -04:00 committed by GitHub
commit b052896c64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1994,16 +1994,12 @@ class Item
} }
/** /**
* Change the owner of a parent item if it had been shared by a forum or a user contact * Change the owner of a parent item if it had been shared by a forum
* *
* (public) forum posts in the new format consist of the regular post by the author * (public) forum posts in the new format consist of the regular post by the author
* followed by an announce message sent from the forum account. * followed by an announce message sent from the forum account.
* Changing the owner helps in grouping forum posts. * Changing the owner helps in grouping forum posts.
* *
* For other reshared posts this function changes the owner of that post
* if the author is not a user contact but the post had been shared by one.
* This helps in detecting why this post appeared in the timeline.
*
* @param array $item * @param array $item
* @return void * @return void
*/ */
@ -2022,13 +2018,8 @@ class Item
return; return;
} }
if (($author['contact-type'] != Contact::TYPE_COMMUNITY) && (($parent['owner-id'] != $parent['author-id']) || ($item['uid'] == 0))) { if ($author['contact-type'] != Contact::TYPE_COMMUNITY) {
logger::info('The resharer is no forum and the parent is reshared or not a personal post: quit', ['resharer' => $item['author-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]); logger::info('The resharer is no forum: quit', ['resharer' => $item['author-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
return;
}
if (($author['contact-type'] != Contact::TYPE_COMMUNITY) && (Contact::isSharing($parent['author-link'], $item['uid']) || $item['origin'])) {
logger::info('The parent author is a following contact: quit', ['author' => $parent['author-link'], 'uid' => $item['uid']]);
return; return;
} }