Merge pull request #12256 from annando/issue-12189

Issue 12189: Quote share a feed now shares the linked feed url
pull/12264/head
Hypolite Petovan 6 days ago committed by GitHub
commit e1b259fc4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      mod/item.php
  2. 5
      src/Module/Post/Share.php

@ -239,6 +239,8 @@ function item_post(App $a) {
$att_bbcode = "\n" . PageInfo::getFooterFromData($attachment);
$body .= $att_bbcode;
} elseif (preg_match("/\[attachment\](.*?)\[\/attachment\]/ism", $body, $matches)) {
$body = preg_replace("/\[attachment].*?\[\/attachment\]/ism", PageInfo::getFooterFromUrl($matches[1]), $body);
}
// Convert links with empty descriptions to links without an explicit description

@ -24,6 +24,7 @@ namespace Friendica\Module\Post;
use Friendica\App;
use Friendica\Content;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\Core\System;
use Friendica\Model\Item;
@ -59,7 +60,7 @@ class Share extends \Friendica\BaseModule
System::httpError(403);
}
$item = Post::selectFirst(['private', 'body', 'uri'], ['id' => $post_id]);
$item = Post::selectFirst(['private', 'body', 'uri', 'plink', 'network'], ['id' => $post_id]);
if (!$item || $item['private'] == Item::PRIVATE) {
System::httpError(404);
}
@ -67,6 +68,8 @@ class Share extends \Friendica\BaseModule
$shared = $this->contentItem->getSharedPost($item, ['uri']);
if ($shared && empty($shared['comment'])) {
$content = '[share]' . $shared['post']['uri'] . '[/share]';
} elseif ($item['network'] == Protocol::FEED) {
$content = '[attachment]' . $item['plink'] . '[/attachment]';
} else {
$content = '[share]' . $item['uri'] . '[/share]';
}

Loading…
Cancel
Save