Merge pull request #9168 from annando/issue-9135

Issue 9135: Display only reshared posts at the top
This commit is contained in:
Hypolite Petovan 2020-09-09 10:46:01 -04:00 committed by GitHub
commit c7a69bbc3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 10 deletions

View file

@ -727,7 +727,12 @@ function conversation_fetch_comments($thread_items, $pinned) {
&& ($row['thr-parent'] == $row['parent-uri']) && ($row['received'] > $received)
&& Contact::isSharing($row['author-id'], $row['uid'])) {
$direction = ['direction' => 3, 'title' => DI::l10n()->t('%s reshared this.', $row['author-name'])];
$actor = ['link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']];
$author = ['uid' => 0, 'id' => $row['author-id'],
'network' => $row['author-network'], 'url' => $row['author-link']];
$url = '<a href="'. htmlentities(Contact::magicLinkByContact($author)) .'">' . htmlentities($row['author-name']) . '</a>';
$actor = ['url' => $url, 'link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']];
$received = $row['received'];
}
@ -758,10 +763,13 @@ function conversation_fetch_comments($thread_items, $pinned) {
if (!empty($direction)) {
foreach ($parentlines as $line) {
$comments[$line]['direction'] = $direction;
if (!empty($actor) && DI::pConfig()->get(local_user(), 'system', 'display_resharer') ) {
$comments[$line]['owner-link'] = $actor['link'];
$comments[$line]['owner-avatar'] = $actor['avatar'];
$comments[$line]['owner-name'] = $actor['name'];
if (!empty($actor)) {
$comments[$line]['reshared'] = DI::l10n()->t('%s reshared this.', $actor['url']);
if (DI::pConfig()->get(local_user(), 'system', 'display_resharer') ) {
$comments[$line]['owner-link'] = $actor['link'];
$comments[$line]['owner-avatar'] = $actor['avatar'];
$comments[$line]['owner-name'] = $actor['name'];
}
}
}
}

View file

@ -497,6 +497,7 @@ class Post
'uriid' => $item['uri-id'],
'return' => (DI::args()->getCommand()) ? bin2hex(DI::args()->getCommand()) : '',
'direction' => $direction,
'reshared' => $item['reshared'] ?? '',
'delivery' => [
'queue_count' => $item['delivery_queue_count'],
'queue_done' => $item['delivery_queue_done'] + $item['delivery_queue_failed'], /// @todo Possibly display it separately in the future

View file

@ -20,6 +20,9 @@
<a name="{{$item.id}}" ></a>
<div class="wall-item-outside-wrapper {{$item.indent}}{{$item.previewing}}{{if $item.owner_url}} wallwall{{/if}}" id="wall-item-outside-wrapper-{{$item.id}}" >
<div class="wall-item-content-wrapper {{$item.indent}} {{$item.shiny}}" id="wall-item-content-wrapper-{{$item.id}}" >
{{if $item.reshared}}
<div class="wall-item-ammounce wall-item-responses" id="wall-item-ammounce-{{$item.id}}">{{$item.reshared nofilter}}</div>
{{/if}}
<div class="wall-item-info{{if $item.owner_url}} wallwall{{/if}}" id="wall-item-info-{{$item.id}}">
{{if $item.owner_url}}
<div class="wall-item-photo-wrapper wwto" id="wall-item-ownerphoto-wrapper-{{$item.id}}" >

View file

@ -1985,6 +1985,7 @@ ul.dropdown-menu li:hover {
}
/* Media Classes */
.wall-item-ammounce,
.media .time,
.media .shared-time,
.media .delivery,

View file

@ -6,7 +6,7 @@
{{elseif $direction.direction == 2}}
<i class="fa fa-download" aria-hidden="true" title="{{$direction.title}}"></i>
{{elseif $direction.direction == 3}}
<i class="fa fa-share-alt" aria-hidden="true" title="{{$direction.title}}"></i>
<i class="fa fa-retweet" aria-hidden="true" title="{{$direction.title}}"></i>
{{elseif $direction.direction == 4}}
<i class="fa fa-hashtag" aria-hidden="true" title="{{$direction.title}}"></i>
{{elseif $direction.direction == 5}}

View file

@ -81,8 +81,8 @@ as the value of $top_child_total (this is done at the end of this file)
<span class="uriid" style="display: none;">{{$item.uriid}}</span>
{{/if}}
<div class="media {{$item.shiny}}">
{{if $item.responses.announce && $mode != 'display'}}
<div class="wall-item-ammounce wall-item-responses" id="wall-item-ammounce-{{$item.id}}">{{$item.responses.announce.output nofilter}}</div>
{{if $item.reshared}}
<div class="wall-item-ammounce wall-item-responses" id="wall-item-ammounce-{{$item.id}}"><i class="fa fa-retweet" aria-hidden="true"></i> {{$item.reshared nofilter}}</div>
{{/if}}
{{* The avatar picture and the photo-menu *}}
<div class="dropdown pull-left"><!-- Dropdown -->
@ -530,9 +530,7 @@ as the value of $top_child_total (this is done at the end of this file)
{{if $item.responses}}
<div class="wall-item-responses">
{{foreach $item.responses as $verb=>$response}}
{{if $verb != 'announce' || $mode == 'display'}}
<div class="wall-item-{{$verb}}" id="wall-item-{{$verb}}-{{$item.id}}">{{$response.output nofilter}}</div>
{{/if}}
{{/foreach}}
</div>
{{/if}}