Merge pull request #12070 from annando/share
Some more improvements for posts with shares
This commit is contained in:
commit
f418687a71
16 changed files with 208 additions and 153 deletions
|
@ -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)) {
|
||||
|
|
|
@ -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 = [
|
||||
|
|
|
@ -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]';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue