From 1ca988b177834467671137c94f17a5948b465f6f Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 15 Feb 2023 09:41:48 +0000 Subject: revisit author_id and fix issue with pinned content --- Zotlabs/Module/Channel.php | 17 ++++++++------- Zotlabs/Widget/Pinned.php | 4 +++- include/conversation.php | 1 + view/js/main.js | 2 +- view/tpl/conv_item.tpl | 2 +- view/tpl/conv_list.tpl | 2 +- view/tpl/pinned_item.tpl | 54 ++++++++++++++-------------------------------- view/tpl/search_item.tpl | 2 +- 8 files changed, 33 insertions(+), 51 deletions(-) diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index d3d72ca10..748d990cb 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -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); diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php index 83036e98c..88a87d0fe 100644 --- a/Zotlabs/Widget/Pinned.php +++ b/Zotlabs/Widget/Pinned.php @@ -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'); diff --git a/include/conversation.php b/include/conversation.php index caad5bb0e..2f0b6f6fd 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -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), diff --git a/view/js/main.js b/view/js/main.js index 7250b6d2e..dcdf58396 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -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) { - $(' ').insertBefore('#wall-item-info-' + id); + $(' ').insertAfter('#wall-item-ago-' + id); me.html(me.html().replace(aStr['pin_item'],aStr['unpin_item'])); }; }) diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index aa10e53ff..8e66aa505 100644 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -55,7 +55,7 @@ {{/if}} {{$item.name}}{{if $item.owner_url}} {{$item.via}} {{$item.owner_name}}{{/if}}
- {{$item.linktitle}} + {{$item.author_id}}
diff --git a/view/tpl/conv_list.tpl b/view/tpl/conv_list.tpl index e3d5961ec..350b1c328 100644 --- a/view/tpl/conv_list.tpl +++ b/view/tpl/conv_list.tpl @@ -55,7 +55,7 @@
{{/if}} {{$item.name}}{{if $item.owner_url}} {{$item.via}} {{$item.owner_name}}{{/if}}
- {{$item.linktitle}} + {{$item.author_id}}
diff --git a/view/tpl/pinned_item.tpl b/view/tpl/pinned_item.tpl index 09cc770a6..ece386b72 100644 --- a/view/tpl/pinned_item.tpl +++ b/view/tpl/pinned_item.tpl @@ -1,15 +1,4 @@ -{{if $hide}} - -{{/if}} -
+
{{if $photo}} @@ -40,29 +29,6 @@
{{/if}} {{/if}} - -
@@ -79,7 +45,7 @@
{{$name}}{{if $owner_url}} {{$via}} {{$owner_name}}{{/if}}
- {{$linktitle}} + {{$author_id}}
@@ -102,8 +68,6 @@
- - {{if $divider}}
{{/if}} @@ -238,3 +202,17 @@
+{{if $hide}} + +{{/if}} + diff --git a/view/tpl/search_item.tpl b/view/tpl/search_item.tpl index 821ecf699..70c030b19 100644 --- a/view/tpl/search_item.tpl +++ b/view/tpl/search_item.tpl @@ -49,7 +49,7 @@
{{/if}} {{$item.name}}{{if $item.owner_url}} {{$item.via}} {{$item.owner_name}}{{/if}}
- {{$item.linktitle}} + {{$item.author_id}}
-- cgit v1.2.3