1
0
Fork 0

Merge pull request #12070 from annando/share

Some more improvements for posts with shares
This commit is contained in:
Hypolite Petovan 2022-10-27 08:19:23 -04:00 committed by GitHub
commit f418687a71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 208 additions and 153 deletions

View file

@ -122,9 +122,9 @@ function display_init(App $a)
function display_fetchauthor($item)
{
$shared = Item::getShareArray($item);
if (empty($shared['comment']) && !empty($shared['guid']) && !empty($shared['profile'])) {
$contact = Contact::getByURLForUser($shared['profile'], DI::userSession()->getLocalUserId());
$shared = DI::contentItem()->getSharedPost($item, ['author-link']);
if (!empty($shared) && empty($shared['comment'])) {
$contact = Contact::getByURLForUser($shared['post']['author-link'], DI::userSession()->getLocalUserId());
}
if (empty($contact)) {

View file

@ -611,7 +611,7 @@ function item_post(App $a) {
$datarray['author-uri-id'] = ItemURI::getIdByURI($datarray['author-link']);
$datarray['owner-updated'] = '';
$datarray['has-media'] = false;
$datarray['body'] = Item::improveSharedDataInBody($datarray);
$datarray['body'] = DI::contentItem()->improveSharedDataInBody($datarray);
$o = DI::conversation()->create([array_merge($contact_record, $datarray)], 'search', false, true);
@ -652,7 +652,7 @@ function item_post(App $a) {
}
$datarray['uri-id'] = ItemURI::getIdByURI($datarray['uri']);
$datarray['body'] = Item::improveSharedDataInBody($datarray);
$datarray['body'] = DI::contentItem()->improveSharedDataInBody($datarray);
if ($orig_post) {
$fields = [

View file

@ -41,9 +41,9 @@ function share_init(App $a) {
System::exit();
}
$shared = Item::getShareArray($item);
if (empty($shared['comment']) && (!empty($shared['message_id']) || !empty($shared['link']))) {
$content = '[share]' . ($shared['message_id'] ?: $shared['link']) . '[/share]';
$shared = DI::contentItem()->getSharedPost($item, ['uri']);
if (!empty($shared) && empty($shared['comment'])) {
$content = '[share]' . $shared['post']['uri'] . '[/share]';
} else {
$content = '[share]' . $item['uri'] . '[/share]';
}