revisit author_id and fix issue with pinned content

This commit is contained in:
Mario
2023-02-15 09:41:48 +00:00
parent 07fd8cf6cd
commit 1ca988b177
8 changed files with 33 additions and 51 deletions

View File

@@ -247,9 +247,7 @@ class Channel extends Controller {
$channel_acl = ['allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => ''];
}
if ($perms['post_wall']) {
$x = [
'is_owner' => $is_owner,
'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(App::$profile['profile_uid'], 'system', 'use_browser_location')))) ? true : false),
@@ -273,6 +271,12 @@ class Channel extends Controller {
$o .= status_editor($a, $x, false, 'Channel');
}
// Add pinned content
if (!x($_REQUEST, 'mid') && !$search) {
$pinned = new \Zotlabs\Widget\Pinned;
$r = $pinned->widget(intval(App::$profile['profile_uid']), [ITEM_TYPE_POST]);
$o .= $r['html'];
}
}
@@ -423,17 +427,14 @@ class Channel extends Controller {
$items = [];
}
// Add pinned content
if (!x($_REQUEST, 'mid') && !$search) {
$pinned = new \Zotlabs\Widget\Pinned;
$r = $pinned->widget(intval(App::$profile['profile_uid']), [ITEM_TYPE_POST]);
$o .= $r['html'];
}
$mode = (($search) ? 'search' : 'channel');
if ((!$update) && (!$load)) {
//if we got a decoded hash we must encode it again before handing to javascript
$mid = gen_link_id($mid);

View File

@@ -159,7 +159,9 @@ class Pinned {
'hide' => (! $is_new && isset($observer['xchan_hash']) && $observer['xchan_hash'] != $owner['xchan_hash'] ? t("Don't show") : ''),
// end toolbar buttons
'modal_dismiss' => t('Close'),
'responses' => $conv_responses
'responses' => $conv_responses,
'author_id' => (($author['xchan_addr']) ? $author['xchan_addr'] : $author['xchan_url'])
];
$tpl = get_markup_template('pinned_item.tpl');

View File

@@ -802,6 +802,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
'mid' => gen_link_id($item['mid']),
'mids' => json_encode([gen_link_id($item['mid'])]),
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, $profile_link),
'author_id' => (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']),
'profile_url' => $profile_link,
'thread_action_menu' => thread_action_menu($item,$mode),
'thread_author_menu' => thread_author_menu($item,$mode),

View File

@@ -1259,7 +1259,7 @@ function dopin(id) {
$('.dropdown-item-pinnable').html($('.dropdown-item-pinnable').html().replace(aStr['unpin_item'],aStr['pin_item']));
$('.wall-item-pinned').remove()
if(i.length == 0) {
$('<span class="wall-item-pinned" title="' + aStr['pinned'] + '" id="wall-item-pinned-' + id + '"><i class="fa fa-thumb-tack">&nbsp;</i></span>').insertBefore('#wall-item-info-' + id);
$('<span class="wall-item-pinned" title="' + aStr['pinned'] + '" id="wall-item-pinned-' + id + '"><i class="fa fa-thumb-tack">&nbsp;</i></span>').insertAfter('#wall-item-ago-' + id);
me.html(me.html().replace(aStr['pin_item'],aStr['unpin_item']));
};
})

View File

@@ -55,7 +55,7 @@
</div>
{{/if}}
<a href="{{$item.profile_url}}" class="wall-item-name-link u-url"{{if $item.app}} title="{{$item.str_app}}"{{/if}}><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" ><bdi>{{$item.name}}</bdi></span></a>{{if $item.owner_url}}&nbsp;{{$item.via}}&nbsp;<a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}"><bdi>{{$item.owner_name}}</bdi></span></a>{{/if}}<br>
<small class="wall-item-addr opacity-75">{{$item.linktitle}}</small>
<small class="wall-item-addr opacity-75">{{$item.author_id}}</small>
</div>
<div class="text-end ms-auto">
<div class="wall-item-ago text-nowrap opacity-75" id="wall-item-ago-{{$item.id}}">

View File

@@ -55,7 +55,7 @@
</div>
{{/if}}
<a href="{{$item.profile_url}}" class="wall-item-name-link u-url"{{if $item.app}} title="{{$item.str_app}}"{{/if}}><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" ><bdi>{{$item.name}}</bdi></span></a>{{if $item.owner_url}}&nbsp;{{$item.via}}&nbsp;<a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}"><bdi>{{$item.owner_name}}</bdi></span></a>{{/if}}<br>
<small class="wall-item-addr opacity-75">{{$item.linktitle}}</small>
<small class="wall-item-addr opacity-75">{{$item.author_id}}</small>
</div>
<div class="text-end ms-auto">
<div class="wall-item-ago text-nowrap opacity-75" id="wall-item-ago-{{$item.id}}">

View File

@@ -1,15 +1,4 @@
{{if $hide}}
<script>
function dopinhide(id) {
id = id.toString();
if($('#pinned-wrapper-' + id).length) {
$('#pinned-wrapper-' + id).fadeTo('fast', 0.33, function() { this.remove(); });
$.post('pin/hide', { 'id' : id });
}
}
</script>
{{/if}}
<div id="pinned-wrapper-{{$id}}" class="pinned-item thread-wrapper toplevel_item generic-content-wrapper h-entry" data-b64mids='{{$mids}}'>
<div id="pinned-wrapper-{{$id}}" class="pinned-item toplevel_item generic-content-wrapper h-entry" data-b64mids='{{$mids}}'>
<div class="wall-item-outside-wrapper" id="pinned-item-outside-wrapper-{{$id}}">
<div class="clearfix wall-item-content-wrapper" id="pinned-item-content-wrapper-{{$id}}">
{{if $photo}}
@@ -40,29 +29,6 @@
<hr class="m-0">
{{/if}}
{{/if}}
<!--div class="p-2 clearfix wall-item-head{{if !$title && !$event && !$photo}} rounded-top{{/if}}{{if $is_new && !$event}} wall-item-head-new{{/if}}">
<span class="float-end" title="{{$pinned}}"><i class="fa fa-thumb-tack">&nbsp;</i></span>
<div class="wall-item-info" id="pinned-item-info-{{$id}}" >
<div class="wall-item-photo-wrapper{{if $owner_url}} wwfrom{{/if}} h-card p-author" id="pinned-item-photo-wrapper-{{$id}}">
<img src="{{$thumb}}" class="fakelink wall-item-photo u-photo p-name" id="pinned-item-photo-{{$id}}" alt="{{$name}}" data-bs-toggle="dropdown" />
{{if $thread_author_menu}}
<i class="fa fa-caret-down wall-item-photo-caret cursor-pointer" data-bs-toggle="dropdown"></i>
<div class="dropdown-menu">
{{foreach $thread_author_menu as $mitem}}
<a class="dropdown-item" {{if $mitem.href}}href="{{$mitem.href}}"{{/if}} {{if $mitem.action}}onclick="{{$mitem.action}}"{{/if}} {{if $mitem.title}}title="{{$mitem.title}}"{{/if}} >{{$mitem.title}}</a>
{{/foreach}}
</div>
{{/if}}
</div>
</div>
<div class="wall-item-author">
<a href="{{$profile_url}}" title="{{$linktitle}}" class="wall-item-name-link u-url"><span class="wall-item-name" id="pinned-item-name-{{$id}}" >{{$name}}</span></a>{{if $owner_url}}&nbsp;{{$via}}&nbsp;<a href="{{$owner_url}}" title="{{$olinktitle}}" class="wall-item-name-link"><span class="wall-item-name" id="pinned-item-ownername-{{$id}}">{{$owner_name}}</span></a>{{/if}}
</div>
<div class="wall-item-ago" id="pinned-item-ago-{{$id}}">
{{if $verified}}<i class="fa fa-check item-verified" title="{{$verified}}"></i>&nbsp;{{elseif $forged}}<i class="fa fa-exclamation item-forged" title="{{$forged}}"></i>&nbsp;{{/if}}{{if $location}}<span class="wall-item-location p-location" id="pinned-item-location-{{$id}}">{{$location}},&nbsp;</span>{{/if}}<span class="autotime" title="{{$isotime}}"><time class="dt-published" datetime="{{$isotime}}">{{$localtime}}</time>{{if $editedtime}}&nbsp;{{$editedtime}}{{/if}}{{if $expiretime}}&nbsp;{{$expiretime}}{{/if}}</span>{{if $editedtime}}&nbsp;<i class="fa fa-pencil"></i>{{/if}}&nbsp;{{if $app}}<span class="item.app">{{$str_app}}</span>{{/if}}
</div>
</div-->
<div class="p-2 lh-sm d-flex wall-item-head{{if !$title && !$event && !$photo}} rounded-top{{/if}}{{if $is_new && !$event}} wall-item-head-new{{/if}}" >
<div class="wall-item-info pe-2" id="wall-item-info-{{$id}}" >
<div class="wall-item-photo-wrapper{{if $owner_url}} wwfrom{{/if}} h-card p-author" id="wall-item-photo-wrapper-{{$id}}">
@@ -79,7 +45,7 @@
</div>
<div class="wall-item-author text-truncate">
<a href="{{$profile_url}}" title="{{$linktitle}}" class="wall-item-name-link u-url"><span class="wall-item-name" id="pinned-item-name-{{$id}}" >{{$name}}</span></a>{{if $owner_url}}&nbsp;{{$via}}&nbsp;<a href="{{$owner_url}}" title="{{$olinktitle}}" class="wall-item-name-link"><span class="wall-item-name" id="pinned-item-ownername-{{$id}}">{{$owner_name}}</span></a>{{/if}}<br>
<small class="wall-item-addr opacity-75">{{$linktitle}}</small>
<small class="wall-item-addr opacity-75">{{$author_id}}</small>
</div>
<div class="text-end ms-auto">
<div class="wall-item-ago text-nowrap opacity-75" id="wall-item-ago-{{$id}}">
@@ -102,8 +68,6 @@
<div class="wall-item-pinned" title="{{$pinned}}" id="wall-item-pinned-{{$id}}"><i class="fa fa-thumb-tack"></i></div>
</div>
</div>
{{if $divider}}
<hr class="wall-item-divider">
{{/if}}
@@ -238,3 +202,17 @@
</div>
</div>
</div>
{{if $hide}}
<script>
function dopinhide(id) {
id = id.toString();
if($('#pinned-wrapper-' + id).length) {
$('#pinned-wrapper-' + id).fadeTo('fast', 0.33, function() { this.remove(); });
$.post('pin/hide', { 'id' : id });
}
}
</script>
{{/if}}
<script>
$(".pinned-item .autotime").timeago();
</script>

View File

@@ -49,7 +49,7 @@
</div>
{{/if}}
<a href="{{$item.profile_url}}" class="wall-item-name-link u-url"{{if $item.app}} title="{{$item.str_app}}"{{/if}}><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" ><bdi>{{$item.name}}</bdi></span></a>{{if $item.owner_url}}&nbsp;{{$item.via}}&nbsp;<a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}"><bdi>{{$item.owner_name}}</bdi></span></a>{{/if}}<br>
<small class="wall-item-addr opacity-75">{{$item.linktitle}}</small>
<small class="wall-item-addr opacity-75">{{$item.author_id}}</small>
</div>
<div class="text-end ms-auto">
<div class="wall-item-ago text-nowrap opacity-75" id="wall-item-ago-{{$item.id}}">