From 4796bafafe1d337ca3c2df2c261bdb38ce98b47c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Thu, 5 Oct 2023 12:39:31 +0200 Subject: [PATCH] add link to parent of comment --- src/Object/Post.php | 6 ++++-- view/theme/frio/js/theme.js | 10 ++++++++++ view/theme/frio/templates/wall_thread.tpl | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Object/Post.php b/src/Object/Post.php index dd3074cfa3..77912c7b85 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -164,7 +164,7 @@ class Post * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */ - public function getTemplateData(array $conv_responses, string $formSecurityToken, int $thread_level = 1) + public function getTemplateData(array $conv_responses, string $formSecurityToken, int $thread_level = 1, string $parent_guid = "", string $parent_username = "") { $item = $this->getData(); $edited = false; @@ -497,6 +497,8 @@ class Post } $tmp_item = [ + 'parentguid' => $parent_guid, + 'isanswerto' => DI::l10n()->t('is answer to %s', $parent_username), 'template' => $this->getTemplate(), 'type' => implode('', array_slice(explode('/', $item['verb']), -1)), 'comment_firstcollapsed' => false, @@ -610,7 +612,7 @@ class Post $nb_children = count($children); if ($nb_children > 0) { foreach ($children as $child) { - $result['children'][] = $child->getTemplateData($conv_responses, $formSecurityToken, $thread_level + 1); + $result['children'][] = $child->getTemplateData($conv_responses, $formSecurityToken, $thread_level + 1, $tmp_item['guid'], $tmp_item['name']); } // Collapse diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index ef71b8c1d0..733752cfd9 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -184,6 +184,7 @@ $(document).ready(function () { if (typeof searchValue !== "undefined") { $("#nav-search-input-field").val(searchValue); } + } // move the "Save the search" button to the second navbar @@ -941,4 +942,13 @@ function toggleDropdownText(elm) { function hasClass(elem, cls) { return (" " + elem.className + " ").indexOf(" " + cls + " ") > -1; } + +// Go to parent for "is answer to " link in comments below username +function goToParentItem(plink, pguid) { + history.pushState({},"",plink); + var loc = plink.split("/"); + loc.pop(); + loc.push(pguid); + location.href = loc.join("/"); +} // @license-end diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl index b3ade5fe04..14240659d2 100644 --- a/view/theme/frio/templates/wall_thread.tpl +++ b/view/theme/frio/templates/wall_thread.tpl @@ -214,6 +214,10 @@ as the value of $top_child_total (this is done at the end of this file) + {{if !$item.parentguid==""}} + {{$item.isanswerto}} + • + {{/if}}