From d18e6d44ab571a684b9efc1f91959033ea2055a7 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Tue, 13 May 2025 09:42:19 +0200 Subject: [PATCH] fix(issue): show formanswer tooltip only if readable --- inc/issue.class.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/inc/issue.class.php b/inc/issue.class.php index 6e5523d09..e2f93b023 100644 --- a/inc/issue.class.php +++ b/inc/issue.class.php @@ -1080,10 +1080,13 @@ public static function giveItem($itemtype, $option_id, $data, $num) { trigger_error(sprintf("Formanswer ID %s not found", $id), E_USER_WARNING); break; } - try { - $content = $formAnswer->parseTags($formAnswer->getFullForm()); - } catch (Exception $e) { - $content = ''; // Exception when computing the tooltip + $content = ''; + if ($formAnswer->canViewItem()) { + try { + $content = $formAnswer->parseTags($formAnswer->getFullForm()); + } catch (Exception $e) { + $content = ''; // Exception when computing the tooltip + } } break; } @@ -1095,11 +1098,14 @@ public static function giveItem($itemtype, $option_id, $data, $num) { } $key = 'id'; - $tooltip = Html::showToolTip(RichText::getEnhancedHtml($content), [ - 'applyto' => $itemtype.$data['raw'][$key], - 'display' => false, - 'images_gallery' => false - ]); + $tooltip = ''; + if ($content !== '') { + $tooltip = Html::showToolTip(RichText::getEnhancedHtml($content), [ + 'applyto' => $itemtype.$data['raw'][$key], + 'display' => false, + 'images_gallery' => false + ]); + } return '' . sprintf(__('%1$s %2$s'), $name, $tooltip) . '';