Skip to content

Commit cbef735

Browse files
committed
fix(issue): show tooltip only when sub item is readable
1 parent 0d79960 commit cbef735

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

inc/issue.class.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -770,12 +770,14 @@ public static function giveItem($itemtype, $option_id, $data, $num) {
770770
$ticket = new Ticket();
771771
$ticket->getFromDB($id);
772772
$content = $ticket->fields['content'];
773+
$canViewItem = $ticket->canViewItem();
773774
break;
774775

775776
case PluginFormcreatorFormAnswer::class:
776777
$formAnswer = new PluginFormcreatorFormAnswer();
777778
$formAnswer->getFromDB($id);
778779
$content = $formAnswer->parseTags($formAnswer->getFullForm());
780+
$canViewItem = $formAnswer->canViewItem();
779781
break;
780782

781783
default:
@@ -784,10 +786,13 @@ public static function giveItem($itemtype, $option_id, $data, $num) {
784786
$link = self::getFormURLWithID($id) . "&itemtype=".$data['raw']['itemtype'];
785787
$link = self::getFormURLWithID($data['id']);
786788
$key = 'id';
787-
$tooltip = Html::showToolTip(nl2br(Html::Clean($content)), [
788-
'applyto' => $itemtype.$data['raw'][$key],
789-
'display' => false,
790-
]);
789+
$tooltip = '';
790+
if ($canViewItem) {
791+
$tooltip = Html::showToolTip(nl2br(Html::Clean($content)), [
792+
'applyto' => $itemtype.$data['raw'][$key],
793+
'display' => false,
794+
]);
795+
}
791796
return '<a id="' . $itemtype.$data['raw'][$key] . '" href="' . $link . '">'
792797
. sprintf(__('%1$s %2$s'), $name, $tooltip)
793798
. '</a>';

0 commit comments

Comments
 (0)