]> git.mxchange.org Git - friendica.git/commitdiff
Remotely load posts to comment on them on the own page
authorMichael <heluecht@pirati.ca>
Tue, 18 Feb 2020 06:57:38 +0000 (06:57 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 18 Feb 2020 06:57:38 +0000 (06:57 +0000)
src/Model/Profile.php
src/Object/Post.php
view/templates/wall_thread.tpl
view/theme/frio/templates/wall_thread.tpl
view/theme/quattro/templates/wall_thread.tpl
view/theme/vier/templates/wall_thread.tpl

index c08138452046c5ae04e215aa3c991660b9025ee9..4956ef9bb30d456600db5565426af217175f7e5b 100644 (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();
 
index 31cbe7a7e10f51e13e791e73c77e01c3280fb61e..dc4fc51f5fba2b2d2db1faefa34feeb1334d2c85 100644 (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'),
index 0816400d5258ee811e8886a240bc00a62a4cf96d..390f99b46a1f087bac712a1b26a461ca29b395ea 100644 (file)
@@ -83,6 +83,9 @@
                                <img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
                        </div>
                        {{/if}}
+                       {{if $item.remote_comment}}
+                               <div class="wall-item-links-wrapper"><a href="{{$item.remote_comment.2}}" title="{{$item.remote_comment.0}}" target="_blank" class="icon remote-link{{$item.sparkle}} u-url"></a></div>
+                       {{/if}}
                        {{if $item.plink}}
                                <div class="wall-item-links-wrapper"><a href="{{$item.plink.href}}" title="{{$item.plink.title}}" target="_blank" class="icon remote-link{{$item.sparkle}} u-url"></a></div>
                        {{/if}}
index a8d21500fa4186fc6b823bfbf5fb65d18c1662d3..5a0cf57fada66c8a35cbd03167178e52fca61a94 100644 (file)
@@ -287,6 +287,10 @@ as the value of $top_child_total (this is done at the end of this file)
                                {{/if}}
                        {{/if}}
 
+                       {{if $item.remote_comment}}
+                               <a href="{{$item.remote_comment.2}}" class="btn-link button-comments" title="{{$item.remote_comment.0}}"><i class="fa fa-commenting" aria-hidden="true"></i>&nbsp;{{$item.remote_comment.1}}</a>
+                       {{/if}}
+
                        {{* Button to open the comment text field *}}
                        {{if $item.comment}}
                                <button type="button" class="btn-link button-comments" id="comment-{{$item.id}}" title="{{$item.switchcomment}}" {{if $item.thread_level != 1}}onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});" {{else}} onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});"{{/if}}><i class="fa fa-commenting" aria-hidden="true"></i>&nbsp;{{$item.switchcomment}}</button>
index 77d63f6e5d94c9f8bb9424b58afa68d95edd603a..10f8fe99879f82a925bee7ee2d0fa61499ea85b1 100644 (file)
                                 <a href="#" id="filer-{{$item.id}}" onclick="itemFiler({{$item.id}}); return false;" class="filer-item filer-icon" title="{{$item.filer}}">{{$item.filer}}</a>
                        {{/if}}
 
+                       {{if $item.remote_comment}}
+                               <a title="{{$item.remote_comment.0}}" href="{{$item.remote_comment.2}}">{{$item.remote_comment.1}}</a>
+                       {{/if}}
+
                        {{if $item.vote}}
                                <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false">{{$item.vote.like.1}}</a>
                                {{if $item.vote.dislike}}
index 169d1b21405487b29cbff20560c67d48e28d5307..aef411bcaae51755d19615ea92a662947395829f 100644 (file)
                        <div class="wall-item-actions-social">
                        {{if $item.threaded}}
                        {{/if}}
+                       {{if $item.remote_comment}}
+                               <a role="button" title="{{$item.remote_comment.0}}" href="{{$item.remote_comment.2}}"><i class="icon-commenting"><span class="sr-only">{{$item.remote_comment.1}}</span></i></a>
+                       {{/if}}
+
                        {{if $item.comment}}
                                <a role="button" id="comment-{{$item.id}}" class="fakelink togglecomment" onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});" title="{{$item.switchcomment}}"><i class="icon-commenting"><span class="sr-only">{{$item.switchcomment}}</span></i></a>
                        {{/if}}