1
1
Fork 0

Remotely load posts to comment on them on the own page

This commit is contained in:
Michael 2020-02-18 06:57:38 +00:00
commit d64bb0dd8f
6 changed files with 26 additions and 0 deletions

View file

@ -27,6 +27,7 @@ use Friendica\Content\Widget\ContactBlock;
use Friendica\Core\Cache\Duration;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Network\Probe;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
@ -785,6 +786,7 @@ class Profile
$_SESSION['visitor_handle'] = $visitor['addr'];
$_SESSION['visitor_home'] = $visitor['url'];
$_SESSION['my_url'] = $visitor['url'];
$_SESSION['remote_follow'] = Probe::getRemoteFollowLink($visitor['url']);
Session::setVisitorsContacts();

View file

@ -392,6 +392,14 @@ class Post
$ago = DI::l10n()->t('%s (Received %s)', $ago, $ago_received);
}
// Fetching of Diaspora posts doesn't always work. There are issues with reshares and possibly comments
if (($item['network'] != Protocol::DIASPORA) && empty($comment) && !empty(Session::get('remote_follow'))) {
$remote_comment = [DI::l10n()->t('Comment this item on your system'), DI::l10n()->t('remote comment'),
str_replace('{uri}', urlencode($item['uri']), Session::get('remote_follow'))];
} else {
$remote_comment = '';
}
$tmp_item = [
'template' => $this->getTemplate(),
'type' => implode("", array_slice(explode("/", $item['verb']), -1)),
@ -455,6 +463,7 @@ class Post
'switchcomment' => DI::l10n()->t('Comment'),
'reply_label' => DI::l10n()->t('Reply to %s', $name_e),
'comment' => $comment,
'remote_comment' => $remote_comment,
'menu' => DI::l10n()->t('More'),
'previewing' => $conv->isPreview() ? ' preview ' : '',
'wait' => DI::l10n()->t('Please wait'),